new State(object3D, timestamp)
Store state of context at a given time
Parameters:
Name | Type | Description |
---|---|---|
object3D | Object3D | context root object3D |
timestamp | number | time |
- Source
Members
_consumed :boolean
flag to determine if state has been consumed/treated
Type:
- boolean
- Source
object3D :Object3D
context root object3D
Type:
- Source
timestamp :number
time when the state has been created in ms
Type:
- number
- Source
Methods
add(diff) → {State}
Compute next state based on a Diff
Parameters:
Name | Type | Description |
---|---|---|
diff | Diff | diff between two State |
- Source
Returns:
- next state
- Type:
- State
clone() → {State}
- Source
Returns:
- clone of state
- Type:
- State
equals(state) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
state | State | state to compare to |
- Source
Returns:
- true if states are equal
- Type:
- boolean
getObject3D() → {Object3D}
- Source
Returns:
- state object3D
- Type:
- Object3D
getTimestamp() → {number}
- Source
Returns:
- state timestamp
- Type:
- number
hasBeenConsumed() → {boolean}
- Source
Returns:
- return true if state has been consumed/treated
- Type:
- boolean
includes(uuid) → {boolean}
Check if there is an object3D with a given uuid
Parameters:
Name | Type | Description |
---|---|---|
uuid | string | uuid to be check |
- Source
Returns:
- true if there is an object3D with this uuid, false otherwise
- Type:
- boolean
setConsumed(value)
Parameters:
Name | Type | Description |
---|---|---|
value | boolean | new consumed value |
- Source
sub(previousState) → {Diff}
Compute the diff between this and previous state
Parameters:
Name | Type | Description |
---|---|---|
previousState | State | state passed to compute the diff with this |
- Source
Returns:
diff between this and previousState
- Type:
- Diff
toJSON() → {object}
export state to serializable json object
- Source
Returns:
- serializable json object
- Type:
- object
(static) interpolate(s1, s2, ratio) → {State}
Compute a state interpolated between s1 and s2 with a given ratio
Parameters:
Name | Type | Description |
---|---|---|
s1 | State | first state if ratio = 0, result = s1 |
s2 | State | second state if ratio = 1, result = s2 |
ratio | number | a number between 0 => 1 |
- Source
Returns:
- interpolated state
- Type:
- State