new State(scope, optsopt)
State constructor
Parameters:
| Name |
Type |
Attributes |
Description |
scope |
Object
|
|
|
opts |
Object
|
<optional>
|
Initial state options
Properties
| Name |
Type |
Attributes |
Default |
Description |
projection |
String
|
<optional>
|
DEFAULT_PROJECTION
|
Initial projection
type. |
allowControls |
Boolean
|
<optional>
|
true
|
Allow special controls to be
user. |
forceFocus |
Boolean
|
<optional>
|
false
|
Force focus to axis frame. This
will hijack mouse and key events. |
resizable |
Boolean
|
<optional>
|
false
|
Allow the axis frame to be
resizable. |
isClickable |
Boolean
|
<optional>
|
true
|
Allow the axis frame to be
clickable. |
inverted |
Boolean
|
<optional>
|
false
|
Inverts directional controls. |
radius |
Number
|
<optional>
|
400
|
= Geometry radius. |
height |
Number
|
<optional>
|
|
Frame height. |
width |
Number
|
<optional>
|
|
Frame width. |
muted |
Boolean
|
<optional>
|
false
|
Initial vieo muted state. |
allowWheel |
Boolean
|
<optional>
|
false
|
Use mouse wheel for zooming. |
scrollVelocity |
Number
|
<optional>
|
DEFAULT_SCROLL_VELOCITY
|
Scroll velocity. |
autoplay |
Boolean
|
<optional>
|
false
|
Indicates whether a video should
autoplay after loading. |
fov |
Number
|
<optional>
|
|
Field of view. |
isImage |
Boolean
|
<optional>
|
false
|
Force rendering of image instead of
a video. |
friction |
Number
|
<optional>
|
DEFAULT_FRICTION
|
Friction to
apply to x and y coordinates. |
mouseFriction |
Number
|
<optional>
|
DEFAULT_MOUSE_MOVEMENT_FRICTION
|
Friction fractor to apply to mouse movements. |
interpolationFactor |
Number
|
<optional>
|
DEFAULT_INTERPOLATION_FACTOR
|
Interpolation factor to apply to quaternion rotations. |
updateTimeout |
Number
|
<optional>
|
DEFAULT_CONTROLLER_UPDATE_TIMEOUT
|
View controller update timeout. |
webgl |
Boolean
|
<optional>
|
true
|
Use WebGL rendering. |
isPreviewFrame |
Boolean
|
<optional>
|
false
|
Indicates frame is a
preview frame preventing a refresh loop from occurring unless explicitly
called. |
lockPoles |
Boolean
|
<optional>
|
true
|
Locks orientation at north and
south poles (-PI/2, PI/2). |
|
- Source:
Extends
Members
allowControls
Predicate indicating control are allowed.
- Source:
allowWheel
Predicate indicating the use of the mouse wheel.
- Source:
animationFrameID
Animation frame ID.
- Source:
cache
State cache.
- Source:
center
Known center for frame of reference.
- Source:
controllerUpdateTimeout
Controller update timeout value.
- Source:
currentTime
Currently played video time.
- Source:
dragstart
Points representing a drag offset.
- Source:
duration
Total duration in seconds for video.
- Source:
euler
Current euler rotation angles.
- Source:
forceFocus
Predicate indicating focus should be forced.
- Source:
forceVideo
Predicate indicating if video rendering should be forced.
- Source:
fov
Current field of view.
- Source:
friction
Friction to apply to x and y coordinates.
- Source:
geometry
Current geometry type.
- Source:
height
Known frame height.
- Source:
interpolationFactor
Interpolation factor to apply to quaternion rotations.
- Source:
intervalRotations
Interval rotations.
- Source:
isAnimating
Predicate indicating an animation is occuring.
- Source:
isClickable
Predicate to indicating if Axis is clickable.
- Source:
isCrossOrigin
Predicate indicating if media resource is cross origin.
- Source:
isEnded
Predicate indicating if video has ended.
- Source:
isFocused
Predicate indicating if Axis is focused.
- Source:
isFullscreen
Predicate indicating fullscreen is active.
- Source:
isHMDAvailable
Predicate indicating if an HMD device is connected.
- Source:
isHMDPositionSensorAvailable
Predicate indicating if an HMD device sensor is connected.
- Source:
isImage
Predicate indicating if frame is an image.
- Source:
isInverted
Inverted state.
- Source:
isKeydown
Predicate indicating if key is down.
- Source:
isMousedown
Predicate indicating the mouse is down.
- Source:
isMuted
Predicate indicating if video is muted.
- Source:
isPaused
Predicate indicating is video is paused.
- Source:
isPlaying
Predicate indicating if video is playing.
- Source:
isPreviewFrame
Preview frame state predicate..
- Source:
isReady
Predicate indicating if Axis is ready.
- Source:
isResizable
Predicate indicating axis is resizable.
- Source:
isStopped
Predicate indicating if video was stopped.
- Source:
isTouching
Predicate indicating if touching.
- Source:
isVREnabled
Predicate indicating VR support.
- Source:
isVRPossible
Predicate indicating if VR display is possible.
- Source:
lastDevicePixelRatio
Last known device pixel ratio.
- Source:
lastDimensions
Last known dimensions.
- Source:
lastRefresh
Last known refresh.
- Source:
lastSize
Last known size.
- Source:
lastVolume
Last known volume level.
- Source:
lockPoles
Predicate indicating if north/south pole orientation should be locked.
- Source:
mousedownTimestamp
Last known mousedown interaction.
- Source:
mouseFriction
Friction to apply to mouse movements.
- Source:
orientation
Current device orientation.
- Source:
orientationQuaternion
Original quaternion.
- Source:
originalfov
Original fov value.
- Source:
originalsize
Original content size.
- Source:
percentloaded
Percent of content loaded.
- Source:
pointerX
X coordinate.
- Source:
pointerY
Y coordinate.
- Source:
projection
Current projection type.
- Source:
radius
Current geometry radius.
- Source:
scope
Current scope for the instance.
- Source:
scrollVelocity
Scroll velocity.
- Source:
shouldAutoplay
Predicate indicating if a video should autoplay.
- Source:
shouldUpdate
Allow for updates to be skippped.
- Source:
src
Current frame source.
- Source:
tmp
Temporary values.
- Source:
touch
Known touch coordinates.
- Source:
useWebGL
Predicate indicating if WebGL is being used.
- Source:
vim
Vim mode ;)
- Source:
vrHMD
Currently connected VR HMD if applicable.
- Source:
vrPollID
VR polling ID.
- Source:
vrPositionSensor
Currently connected position sensor vr device.
- Source:
width
Known frame width.
- Source:
xAxisCenter
X axis center.
- Source:
zee
Zee quaternion.
- Source:
Methods
isConstrainedWith(key) → {Boolean}
Predicate to determine if state is constrained by key.
Parameters:
| Name |
Type |
Description |
key |
String
|
Key path to determine if there is a constraint. |
- Source:
Returns:
-
Type
-
Boolean
pollForVRDevice() → {Boolean}
Polls for a connected HMD
- Source:
Fires:
Returns:
-
Type
-
Boolean
ready()
Sets a ready state.
- Source:
Fires:
reset(overridesopt) → {Object}
Resets state values
Parameters:
| Name |
Type |
Attributes |
Description |
overrides |
Object
|
<optional>
|
Optionals overrides |
- Source:
Returns:
-
Type
-
Object
toJSON() → {Object}
Converts state to a JSON serializable object.
- Source:
Returns:
-
Type
-
Object
update(key, value)
Updates state value by key
Parameters:
| Name |
Type |
Description |
key |
String
|
State key to update. |
value |
Mixed
|
State value to update for key. |
- Source:
Fires:
Events
ready
Ready event.
- Source:
update
Update event.
Type:
Properties:
| Name |
Type |
Description |
key |
String
|
Updated property key |
value |
Mixed
|
Updated property value |
previous |
Mixed
|
Previous value before update. |
- Source: