AnimationCurve
ClassA curve that contains a set of keyframes and can evaluate values at specific timestamps.
- Available on all platforms
Since Lens Scripting v234
Index
Properties
Methods
Example
// Example of using Animation Curve
// creating keyframes
var A = AnimationCurve.createKeyFrame();
var B = AnimationCurve.createKeyFrame();
// creating AnimationCurve
var curve = AnimationCurve.create();
A.time = 0.0;
A.value = 0.0;
B.time = 1.0;
B.value = 1.0;
curve.addKeyframe(A);
curve.addKeyframe(B);
let idxB = curve.addKeyframe(B);
// evaluating value
var value = curve.evaluate(0.5);
Extends
Properties
keyFrameCount
readonlykeyFrameCount:number
The number of keyframes in the animation curve.
Since
Lens Scripting Version 234
Methods
addKeyframe()
addKeyframe(
frame?):void
Adds a keyframe to the curve. The curve takes a copy of the keyframe's data; to edit it afterwards, retrieve the live handle via AnimationCurve#getKeyFrame.
Parameters
| Parameter | Type |
|---|---|
frame? | AnimationKeyFrame |
Returns
void
Since
Lens Scripting Version 234
create()
staticcreate():AnimationCurve
Create new animation curve.
Returns
AnimationCurve
Since
Lens Scripting Version 234
createEasingCurve()
staticcreateEasingCurve(startValue,endValue,x1,y1,x2,y2,time?):AnimationCurve
Creates curve based on CSS easing values. The optional time argument sets the
end time of the curve; the curve spans from time 0 to time (defaults to 1.0).
Parameters
| Parameter | Type |
|---|---|
startValue | number |
endValue | number |
x1 | number |
y1 | number |
x2 | number |
y2 | number |
time? | number |
Returns
AnimationCurve
Since
Lens Scripting Version 234
createKeyFrame()
staticcreateKeyFrame():AnimationKeyFrame
Create new animation keyframe
Returns
Since
Lens Scripting Version 234
evaluate()
evaluate(
time):number
Evaluate value of the curve at specific point.
Parameters
| Parameter | Type |
|---|---|
time | number |
Returns
number
Since
Lens Scripting Version 234
getKeyFrame()
getKeyFrame(
index):AnimationKeyFrame
Get the AnimationKeyFrame at the passed in index. The returned object
is a live handle into the curve — editing its time, value, or
tangent properties updates the curve directly.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
Since
Lens Scripting Version 234
getTypeName()
staticgetTypeName():TypeName<AnimationCurve>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<AnimationCurve>
Since
Lens Scripting Version 234
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
removeKeyFrame()
removeKeyFrame(
t):void
Remove animation keyframe at specific timestamp. The closest keyframe will be deleted.
Parameters
| Parameter | Type |
|---|---|
t | number |
Returns
void
Since
Lens Scripting Version 234