zig.js

ZDK for Javascript

Summary
zig.jsZDK for Javascript
Enumerations
zig.JointList of Joint ID’s
zig.OrientationPossible orientations for oriented controls (Fader, for instance)
SteadyDetectorDetects steady
Events
steadyTriggered when hand is steady.
unsteadyTriggered when hand is unsteady.
Functions
addPositionAdd an external position [x,y,z] to the steady detector
Properties
maxVarianceSteady detector sensitivity
isSteadyIs hand steady right now? 
FaderAxis aligned fader.
Events
valuechangeTriggered whenever the fader value changes
edgeTriggered when the fader reaches an edge (value of 0 or 1).
hoverstartTriggered when the hand is hovering over Fader.hoverItem
hoverstopTriggered when the hand is not hovering over Fader.hoverItem any more
Properties
itemsCountHow many logical items on our Fader
hysteresisUsed by Fader.hoverstart and Fader.hoverstop events.
initialValueValue of fader when hand is in the initial focus position of the UI session
flipUse this to flip the value of the fader
valueCurrent fader value.
hoverItemLogical hovered item.
driftAmountIf larger than 0, the fader will drift towards current hand point until fader value is initialValue
autoMoveToContainIf true, the fader will always move to contain current hand point
sizePhysical size of fader, in millimeters
orientationWhich zig.Orientation is this fader aligned to?
Functions
updatePositionManually update a fader with external positions
updateValueManually update the fader with external values
moveToMove the fader so that when the hand is at given position, the Fader.value will be given value
moveToContainMove the fader to ensure that given position is within the fader bounds
PushDetectorDetects push gestures
Events
pushPush
releaseRelease
clickClick
Properties
isPushedpush state, true when pushed.
pushProgressNormalized push progress, useful for push visualization on a cursor
pushTimeTimestamp of last push
driftAmountHow fast should the push detector drift after the hand point
SwipeDetectorDetects swipes
Events
swipeupSwipe up
swipedownSwipe down
swipeleftSwipe left
swiperightSwipe right
swipeTriggered every swipe with direction argument.
swipereleaseTriggered after a swipe is ‘released’, when the hand moves back towards the initial position
Properties
driftAmountHow fast should the swipe detector follow the hand point
horizontalFaderInternal Fader used to detect horizontal swipes.
verticalFaderInternal Fader used to detect vertical swipes.
isSwipedTrue when the swipe detector is ‘swiped’, between one of the swipe* events and the swiperelease event
CursorBasic cursor, implemented using <Fader2D> and PushDetector
Events
pushPush
releaseRelease
clickClick
WaveDetectorDetects wave gestures
Events
waveTriggered when a wave gesture is detected
Properties
faderThe Fader used internally by the wave detector
numberOfWavesHow many waves before we trigger the wave event
HandSessionDetectorManages the lifetime of hand point based sessions.
Events
sessionstart(focusPosition)Triggered when a hand session is started, with the initial focus position as an argument
sessionupdate(position)Triggered every frame during a session with current hand position
sessionendTriggered when the session ends.
Properties
shouldRotateHandAttempt to normalize hand positions to sensor center.
shouldSmoothPointsShould hand points be smoothed
startOnWaveShould a hand session start when user waves?
startOnSteadyShould a hand session start on hand steady?
EngageFirstUserInSessionWaits for the first user in session
EngageUsersWithSkeletonWaits for the first n users with skeleton tracking to enter the frame
UserJointRepresents a tracked joint
Properties
idThe zig.Joint of this joint.
positionJoint position as 3d vector [x,y,z] in millimeters relative to the depth sensor [x,y,z] Read only.
rotationJoint orientation as 3x3 rotation matrix relative to the depth sensor.
UserRepresents a tracked user
Events
userupdateCalled every frame, with the tracked User as the single argument
Properties
idUser id as reported by middleware.
positionTrackedtrue if user has a valid position.
positionPosition of user relative to the sensor, only valid if positionTracked is true.
skeletonTrackedtrue if user has full body skeleton data available.
skeletonFull body skeleton data, only valid if skeletonTracked is true.
Functions
mapJointToControlUpdates a control with data from a specific zig.Joint for tracked User
zig
Events
userfound(user)Triggered when a new User enters the scene
userleft(user)Triggered when a tracked User leaves the scene
dataupdateTriggered every frame
statuschangeTriggered when sensorConnected changes
Functions
initInitializes zigjs using an existing plugin object
embedInitializes zigjs by embedding a new plugin object in the dom
Properties
pluginInstalledtrue if zig.js plugin is installed
versionZig.js version number, not to be confused with the plugin version number.
pluginVersionBrowser plugin version, not to be confused with zig.js version
verboseOutput zig.js trace messages to console
usersCollection of Users currently tracked, indexed by User.id.
sensorConnectedtrue when the a depth sensor is connected, false otherwise

Enumerations

zig.Joint

List of Joint ID’s

zig.Orientation

Possible orientations for oriented controls (Fader, for instance)

SteadyDetector

Detects steady

Summary
Events
steadyTriggered when hand is steady.
unsteadyTriggered when hand is unsteady.
Functions
addPositionAdd an external position [x,y,z] to the steady detector
Properties
maxVarianceSteady detector sensitivity
isSteadyIs hand steady right now? 

Events

steady

Triggered when hand is steady.  Triggered only once per steady

unsteady

Triggered when hand is unsteady.  Triggered only once per unsteady.

Functions

addPosition

function addPosition(position)

Add an external position [x,y,z] to the steady detector

Arguments

positionthe external position [x,y,z] to add

Properties

maxVariance

Steady detector sensitivity

isSteady

Is hand steady right now?  Read only.

Fader

Axis aligned fader.  Can be oriented on x, y, or z.  The fader can also be split up into logical items using itemsCount.

Summary
Events
valuechangeTriggered whenever the fader value changes
edgeTriggered when the fader reaches an edge (value of 0 or 1).
hoverstartTriggered when the hand is hovering over Fader.hoverItem
hoverstopTriggered when the hand is not hovering over Fader.hoverItem any more
Properties
itemsCountHow many logical items on our Fader
hysteresisUsed by Fader.hoverstart and Fader.hoverstop events.
initialValueValue of fader when hand is in the initial focus position of the UI session
flipUse this to flip the value of the fader
valueCurrent fader value.
hoverItemLogical hovered item.
driftAmountIf larger than 0, the fader will drift towards current hand point until fader value is initialValue
autoMoveToContainIf true, the fader will always move to contain current hand point
sizePhysical size of fader, in millimeters
orientationWhich zig.Orientation is this fader aligned to?
Functions
updatePositionManually update a fader with external positions
updateValueManually update the fader with external values
moveToMove the fader so that when the hand is at given position, the Fader.value will be given value
moveToContainMove the fader to ensure that given position is within the fader bounds

Events

valuechange

Triggered whenever the fader value changes

edge

Triggered when the fader reaches an edge (value of 0 or 1).  Will only trigger once per edge

hoverstart

Triggered when the hand is hovering over Fader.hoverItem

hoverstop

Triggered when the hand is not hovering over Fader.hoverItem any more

Properties

itemsCount

How many logical items on our Fader

hysteresis

Used by Fader.hoverstart and Fader.hoverstop events.

initialValue

Value of fader when hand is in the initial focus position of the UI session

flip

Use this to flip the value of the fader

value

Current fader value.  Useful for visualizing the fader

hoverItem

Logical hovered item.  -1 if not in session

driftAmount

If larger than 0, the fader will drift towards current hand point until fader value is initialValue

autoMoveToContain

If true, the fader will always move to contain current hand point

size

Physical size of fader, in millimeters

orientation

Which zig.Orientation is this fader aligned to?

Functions

updatePosition

function updatePosition(position)

Manually update a fader with external positions

Arguments

positionexternal position [x,y,z]

updateValue

function updateValue(value)

Manually update the fader with external values

Arguments

valuenormalized (0-1) external value

moveTo

function moveTo(position,
value)

Move the fader so that when the hand is at given position, the Fader.value will be given value

Arguments

positionposition [x,y,z]
valuetarget value for given position

moveToContain

function moveToContain(position)

Move the fader to ensure that given position is within the fader bounds

Arguments

positionposition [x,y,z]

PushDetector

Detects push gestures

Summary
Events
pushPush
releaseRelease
clickClick
Properties
isPushedpush state, true when pushed.
pushProgressNormalized push progress, useful for push visualization on a cursor
pushTimeTimestamp of last push
driftAmountHow fast should the push detector drift after the hand point

Events

push

Push

release

Release

click

Click

Properties

isPushed

push state, true when pushed.  read only

pushProgress

Normalized push progress, useful for push visualization on a cursor

pushTime

Timestamp of last push

driftAmount

How fast should the push detector drift after the hand point

SwipeDetector

Detects swipes

Summary
Events
swipeupSwipe up
swipedownSwipe down
swipeleftSwipe left
swiperightSwipe right
swipeTriggered every swipe with direction argument.
swipereleaseTriggered after a swipe is ‘released’, when the hand moves back towards the initial position
Properties
driftAmountHow fast should the swipe detector follow the hand point
horizontalFaderInternal Fader used to detect horizontal swipes.
verticalFaderInternal Fader used to detect vertical swipes.
isSwipedTrue when the swipe detector is ‘swiped’, between one of the swipe* events and the swiperelease event

Events

swipeup

Swipe up

swipedown

Swipe down

swipeleft

Swipe left

swiperight

Swipe right

swipe

Triggered every swipe with direction argument.  Direction will be one of ‘up’, ‘down’, ‘left’, or ‘right’.

swiperelease

Triggered after a swipe is ‘released’, when the hand moves back towards the initial position

Properties

driftAmount

How fast should the swipe detector follow the hand point

horizontalFader

Internal Fader used to detect horizontal swipes.  Read only.

verticalFader

Internal Fader used to detect vertical swipes.  Read only.

isSwiped

True when the swipe detector is ‘swiped’, between one of the swipe* events and the swiperelease event

Cursor

Basic cursor, implemented using <Fader2D> and PushDetector

Summary
Events
pushPush
releaseRelease
clickClick

Events

push

Push

release

Release

click

Click

WaveDetector

Detects wave gestures

Summary
Events
waveTriggered when a wave gesture is detected
Properties
faderThe Fader used internally by the wave detector
numberOfWavesHow many waves before we trigger the wave event

Events

wave

Triggered when a wave gesture is detected

Properties

fader

The Fader used internally by the wave detector

numberOfWaves

How many waves before we trigger the wave event

HandSessionDetector

Manages the lifetime of hand point based sessions.

Summary
Events
sessionstart(focusPosition)Triggered when a hand session is started, with the initial focus position as an argument
sessionupdate(position)Triggered every frame during a session with current hand position
sessionendTriggered when the session ends.
Properties
shouldRotateHandAttempt to normalize hand positions to sensor center.
shouldSmoothPointsShould hand points be smoothed
startOnWaveShould a hand session start when user waves?
startOnSteadyShould a hand session start on hand steady?

Events

sessionstart(focusPosition)

Triggered when a hand session is started, with the initial focus position as an argument

sessionupdate(position)

Triggered every frame during a session with current hand position

sessionend

Triggered when the session ends.  This can happen if tracked hand is lowered, or if the tracked user leaves the scene

Properties

shouldRotateHand

Attempt to normalize hand positions to sensor center.  Makes implementing UI controls a bit easier if we can assume the user is always facing the sensor, even when this isn’t the case

shouldSmoothPoints

Should hand points be smoothed

startOnWave

Should a hand session start when user waves?

startOnSteady

Should a hand session start on hand steady?

EngageFirstUserInSession

Waits for the first user in session

EngageUsersWithSkeleton

Waits for the first n users with skeleton tracking to enter the frame

UserJoint

Represents a tracked joint

Summary
Properties
idThe zig.Joint of this joint.
positionJoint position as 3d vector [x,y,z] in millimeters relative to the depth sensor [x,y,z] Read only.
rotationJoint orientation as 3x3 rotation matrix relative to the depth sensor.

Properties

id

The zig.Joint of this joint.  Read only.

position

Joint position as 3d vector [x,y,z] in millimeters relative to the depth sensor [x,y,z] Read only.

rotation

Joint orientation as 3x3 rotation matrix relative to the depth sensor.  Read only.

User

Represents a tracked user

Summary
Events
userupdateCalled every frame, with the tracked User as the single argument
Properties
idUser id as reported by middleware.
positionTrackedtrue if user has a valid position.
positionPosition of user relative to the sensor, only valid if positionTracked is true.
skeletonTrackedtrue if user has full body skeleton data available.
skeletonFull body skeleton data, only valid if skeletonTracked is true.
Functions
mapJointToControlUpdates a control with data from a specific zig.Joint for tracked User

Events

userupdate

Called every frame, with the tracked User as the single argument

Properties

id

User id as reported by middleware.  Read only.

positionTracked

true if user has a valid position.  Read only.

position

Position of user relative to the sensor, only valid if positionTracked is true.  Read only.

skeletonTracked

true if user has full body skeleton data available.  Read only.

skeleton

Full body skeleton data, only valid if skeletonTracked is true.  Collection of UserJoints indexed by UserJoint.idRead only.

Functions

mapJointToControl

function mapJointToControl(joint,
control)

Updates a control with data from a specific zig.Joint for tracked User

Arguments

jointthe zig.Joint to map to the control
controllistener

Return Value

The function returns a listener object that can be used with <removeListener> to remove this joint to control mapping

zig

Summary
Events
userfound(user)Triggered when a new User enters the scene
userleft(user)Triggered when a tracked User leaves the scene
dataupdateTriggered every frame
statuschangeTriggered when sensorConnected changes
Functions
initInitializes zigjs using an existing plugin object
embedInitializes zigjs by embedding a new plugin object in the dom
Properties
pluginInstalledtrue if zig.js plugin is installed
versionZig.js version number, not to be confused with the plugin version number.
pluginVersionBrowser plugin version, not to be confused with zig.js version
verboseOutput zig.js trace messages to console
usersCollection of Users currently tracked, indexed by User.id.
sensorConnectedtrue when the a depth sensor is connected, false otherwise

Events

userfound(user)

Triggered when a new User enters the scene

userleft(user)

Triggered when a tracked User leaves the scene

dataupdate

Triggered every frame

statuschange

Triggered when sensorConnected changes

Functions

init

Initializes zigjs using an existing plugin object

embed

Initializes zigjs by embedding a new plugin object in the dom

Properties

pluginInstalled

true if zig.js plugin is installed

version

Zig.js version number, not to be confused with the plugin version number.  Read only.

pluginVersion

Browser plugin version, not to be confused with zig.js version

verbose

Output zig.js trace messages to console

users

Collection of Users currently tracked, indexed by User.idRead only.

sensorConnected

true when the a depth sensor is connected, false otherwise

Axis aligned fader.
function addPosition(position)
Add an external position [x,y,z] to the steady detector
Logical hovered item.
Triggered when the hand is hovering over Fader.hoverItem
Triggered when the hand is not hovering over Fader.hoverItem any more
Current fader value.
Value of fader when hand is in the initial focus position of the UI session
Possible orientations for oriented controls (Fader, for instance)
function updatePosition(position)
Manually update a fader with external positions
function updateValue(value)
Manually update the fader with external values
function moveTo(position,
value)
Move the fader so that when the hand is at given position, the Fader.value will be given value
function moveToContain(position)
Move the fader to ensure that given position is within the fader bounds
Triggered after a swipe is ‘released’, when the hand moves back towards the initial position
Detects push gestures
Triggered when a wave gesture is detected
List of Joint ID’s
Represents a tracked user
true if user has a valid position.
true if user has full body skeleton data available.
function mapJointToControl(joint,
control)
Updates a control with data from a specific zig.Joint for tracked User
true when the a depth sensor is connected, false otherwise
User id as reported by middleware.
How many logical items on our Fader
Represents a tracked joint
The zig.Joint of this joint.
Close