Global

Methods

checkId()

Check that a string is a naked element id (without leading #)
Source:

color(hexNumber)

Get an rgb object representing a color (as returned in e.g. object material), from a 3 digit or 6 digit hex string.
Parameters:
Name Type Description
hexNumber hexNumber A 3 digit or 6 digit hex number, e.g. 0xFFF or 0xFFFFFF.
Source:

cursorClick(targetSelector)

Simulate a "click" cursor event for an entity. This assumes that a cursor entity has been set up by a call to A.setCursorEntity.
Parameters:
Name Type Description
targetSelector string The DOM Selector of the entity that the mouse is hovering over.
Source:

cursorMouseEnter(targetSelector)

Simulate a "mouseenter" cursor event for an entity. This assumes that a cursor entity has been set up by a call to A.setCursorEntity.
Parameters:
Name Type Description
targetSelector string The DOM Selector of the entity that the mouse is hovering over.
Source:

cursorMouseLeave(targetSelector)

Simulate a "mouseleave" cursor event for an entity. This assumes that a cursor entity has been set up by a call to A.setCursorEntity.
Parameters:
Name Type Description
targetSelector string The DOM Selector of the entity that the mouse is hovering over.
Source:

enterVR()

Enter VR This function also simulates connnection of a pair of Oculus Quest 2 controllers, on entry to VR.
Source:

exitVR()

Exit VR This function also simulates disconnnection of a pair of Oculus Quest 2 controllers, on entry to VR.
Source:

fireCustomEvent(entitySelector, event, detail)

Fire a custom event
Parameters:
Name Type Description
entitySelector string The DOM Selector of the entity to fire the event on
event string The name of the custom event to fire
detail object An optional object containing additional detail to include on the event.
Source:

getEntityAttributeValue(entitySelector, attributeName) → {attributeValue}

Get an attribute value from an entity. This uses a page function, rather than just querying the DOM, because A-Frame does not always flush updates to the DOM.
Parameters:
Name Type Description
entitySelector entitySelector The DOM selector of the entity to query
attributeName attributeName The name of the attribute to query.
Source:
Returns:
- An object containing the value of the attribute
Type
attributeValue

getEntityMaterial(entitySelector)

Get an entity's material (object3D.material of its Mesh)
Parameters:
Name Type Description
entitySelector entitySelector The DOM Selector of the element to query
Source:

getEntityPosition(entitySelector)

Get an entity's local position (object3D.position)
Parameters:
Name Type Description
entitySelector entitySelector The DOM Selector of the entity
Source:

getEntityVisibility(entitySelector) → {object|boolean|boolean}

Get an entity's visibility & clipping data. This could be e.g. a Simulation Result, a Measurement sphere, or an anatomy or device entity.
Parameters:
Name Type Description
entitySelector string The DOM selector of the entity to query
Source:
Returns:
  • o - Object that wraps all the return parameters
    Type
    object
  • o.opacity - Opacity of the entity (0 to 1)
    Type
    boolean
  • o.visible - Whether or not the entity is visible. This only consider's the object3D's local setting, and doesn't consider the fact that parent objects may be invisible, or may have 0 opacity.
    Type
    boolean

pfClick(o)

Simulate a "click" cursor event for an entity.
Parameters:
Name Type Description
o object Object that wraps all the function parameters
Properties
Name Type Description
cursorSelector string The DOM Selector of the entity where the cursor is configured.
targetSelector string The DOM Selector of the entity that is clicked.
Source:

pfCursorMouseEvent(o)

Simulate a "mousenter" or "mouseleave" cursor event for an entity.
Parameters:
Name Type Description
o object Object that wraps all the function parameters
Properties
Name Type Description
cursorSelector string The DOM Selector of the entity where the cursor is configured.
targetSelector string The DOM Selector of the entity that the mouse is hovering over.
eventName string The name of the event to emit.
Source:

pfFireCustomEvent(o)

Fire a custom event
Parameters:
Name Type Description
o object Object that wraps all the function parameters
Properties
Name Type Description
entitySelector string The DOM Selector of the entity to fire the event on
event string The name of the custom event to fire
detail object An optional object containing additional detail to include on the event.
Source:

pfGetEntityAttributeValue(o) → {attributeValue}

Get an attribute value from an entity.
Parameters:
Name Type Description
o object Object that wraps all the function parameters
o.entitySelector The DOM selector of the entity to query
o.attributeName The name of the attribute to query.
Source:
Returns:
- An object containing the value of the attribute
Type
attributeValue

pfGetEntityMaterial(entitySelector)

Get an entity's material (object3D.material of its Mesh)
Parameters:
Name Type Description
entitySelector entitySelector The DOM Selector of the element to query
Source:

pfgetEntityPosition(entitySelector)

Get an object's local position (object3D.position)
Parameters:
Name Type Description
entitySelector entitySelector The DOM Selector of the entity
Source:

pfGetEntityVisibility(entitySelector) → {object|boolean|boolean}

Get an entity's visibility & opacity setttings
Parameters:
Name Type Description
entitySelector string The DOM selector of the entity to query
Source:
Returns:
  • o - Object that wraps all the return parameters
    Type
    object
  • o.opacity - Opacity of the entity (0 to 1)
    Type
    boolean
  • o.visible - Whether or not the entity is visible. This includes analysing the ThreeJS object tree to check for parents whos visibility may be set to false.
    Type
    boolean

pfPointEntityAt(o)

Page Function to point one entity towards another entity. Optionally allows for a configurable offset & direction for the "eyes" of the entity. This is useful for controllers, where the ray origin & direction may vary by controller type.
Parameters:
Name Type Description
o object Object that wraps all the function parameters
Properties
Name Type Description
entitySelector string The DOM Selector of the entity to point at a target.
targetSelector string The DOM Selector of the target to point at.
originOffset object x, y, z co-ordinates. Optional, default is (0, 0, 0)
direction object x, y, z direction vector for the direction of the entity's "eyes". Optional, default is (0, 0, -1)
Source:

pfSetEntityPosition(o)

Set an entity's local position (object3D.position)
Parameters:
Name Type Description
o object Object that wraps all the function parameters
Properties
Name Type Description
entitySelector string The DOM Selector of the entity to re-position
x float The value to set for the x co-ordinate
y float The value to set for the y co-ordinate
z float The value to set for the z co-ordinate
Source:

pfXrEnterVR()

Enter VR (page function) This function also simulates connnection of a pair of Oculus Quest 2 controllers, on entry to VR.
Source:

pointControllerAt(controllerSelector, targetSelector, controllerType)

Point a controller towards another entity.
Parameters:
Name Type Description
controllerSelector string The DOM Selector of the controller to point at a target.
targetSelector string The DOM Selector of the target to point at.
controllerType string The type of controller being used. One of: oculus-touch, oculus-touch-v2, oculus-touch-v3 Similar to pointEntityAt, but allows for adjustment based on ray origin & ray direction, which are set up based on the specified controller.
Source:

pointEntityAt(entitySelector, targetSelector)

Point one entity towards another entity.
Parameters:
Name Type Description
entitySelector string The DOM Selector of the entity to point at a target.
targetSelector string The DOM Selector of the target to point at.
Source:

setCursorEntity(entitySelector)

Set the entity on which the cursor component is configured This lasts until this function is called with a different entitySelector.
Parameters:
Name Type Description
entitySelector string The DOM Selector of the entity that the cursor component is configured on.
Source:

setEntityPosition(entitySelector, x, y, z)

Set an entity's local position (object3D.position) This can be used on any entity, but primarily intended for entities that can move autonomously (e.g. cameras and controllers). For realistc testing of entities within the scene that don't move autonomously consSelectorer moving them using the appropriate ens-user controls (e.g. Transform Controls, grab and move etc.)
Parameters:
Name Type Description
entitySelector enitySelector The DOM Selector of the entity
x float The value to set for the x co-ordinate
y float The value to set for the y co-ordinate
z float The value to set for the z co-ordinate
Source:

setPage(page, viewLogs)

Set a page as the page that functions apply to, and brings it into focus. This lasts until this page is called with a different page
Parameters:
Name Type Description
page object The Playwright "page" object for the page that should become active.
viewLogs boolean Set to true to view all console logs for the page in the Playwright test output.
Source: