Methods
(static) clamp(value, minopt, maxopt) → {number}
Clamp a number between 2 values.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value |
number | Value to clamp. |
||
min |
number |
<optional> |
0 | Minumum value. |
max |
number |
<optional> |
1 | Maximum value. |
Returns:
- Type
- number
(static) interpolateProperty(propertyOwner, propertyName, targetValue, optionsopt) → {Deferred}
Return a deferred promise that can be used to update the value of a numeric
property of this object over time. Pass delta time in milliseconds to the
deferred promise's execute method in an update loop to animate the property
towards the target value.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
propertyOwner |
Object | Object that contains the property to animation. |
||||||||||||||||||||||||||||||||||||
propertyName |
string | Name of the property to animate. |
||||||||||||||||||||||||||||||||||||
targetValue |
number | Target value to reach. |
||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Optional options object Properties
|
Returns:
Resolves with the property's value once it reaches the
target value.
- Type
- Deferred