Skip to main content

QuatSlerpAnimationPropertyTrack

Class

QuatSlerpAnimationPropertyTrack.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Since Lens Scripting v381

QuatSlerpAnimationPropertyTrack. Spherically interpolates a rotation from a fixed from orientation to a fixed to orientation, following the shortest arc, with a stored progress curve driving the SLERP factor over time.

Index

Extends

Methods

addKeyFrame()

addKeyFrame(channels, t): void

Interface function for typed property tracks.

Parameters

ParameterType
channelsAnimationKeyFrame[]
tnumber

Returns

void

Inherited from

AnimationPropertyTrack.addKeyFrame


createFloatFromCurves()

static createFloatFromCurves(x): AnimationPropertyTrack

Creates a FloatCurvePropertyTrack. Stores and samples explicit curves.

Parameters

ParameterType
xAnimationCurve

Returns

AnimationPropertyTrack

Since

Lens Scripting Version 333

Inherited from

AnimationPropertyTrack.createFloatFromCurves


createQuatFromCurves()

static createQuatFromCurves(x, y, z): AnimationPropertyTrack

Creates a QuatPropertyTrack. Samples down curves at 30 FPS and uses SLERP.

Parameters

Returns

AnimationPropertyTrack

Since

Lens Scripting Version 333

Inherited from

AnimationPropertyTrack.createQuatFromCurves


createQuatFromSlerp()

static createQuatFromSlerp(from, to, progress): AnimationPropertyTrack

Creates a track that spherically interpolates (SLERP) a rotation directly from from to to, with progress (an AnimationCurve normally spanning 0 to 1) driving the interpolation factor over time. Because it interpolates in quaternion space, it follows the shortest arc between the two orientations -- unlike AnimationPropertyTrack.createQuatFromCurves, which interpolates per-axis in Euler space and can take the long way around. progress values outside 0 to 1 extrapolate along the same geodesic, which allows overshoot/anticipation easing.

Parameters

ParameterType
fromquat
toquat
progressAnimationCurve

Returns

AnimationPropertyTrack

Since

Lens Scripting Version 381

Example

var from = quat.fromEulerAngles(0, 0, 0);
var to = quat.fromEulerAngles(0, 0, 350 * (Math.PI / 180)); // shortest arc is 10 degrees
var progress = AnimationCurve.createEasingCurve(0.0, 1.0, 0.83, 0, 0.17, 1);
var track = AnimationPropertyTrack.createQuatFromSlerp(from, to, progress);

var layer = AnimationPropertyLayer.create();
layer.setProperty(AnimationPropertyLayer.TransformRotation, track);

Inherited from

AnimationPropertyTrack.createQuatFromSlerp


createVec2FromCurves()

static createVec2FromCurves(x, y): AnimationPropertyTrack

Creates a Vec2CurvePropertyTrack. Stores and samples explicit curves.

Parameters

Returns

AnimationPropertyTrack

Since

Lens Scripting Version 381

Example

var xCurve = AnimationCurve.createEasingCurve(0.0, 0.0, 0.83, 0, 0.17, 1);
var yCurve = AnimationCurve.createEasingCurve(0.0, 1.0, 0.83, 0, 0.17, 1);
var track = AnimationPropertyTrack.createVec2FromCurves(xCurve, yCurve);

var layer = AnimationPropertyLayer.create();
layer.setCustomProperty("uvOffset", track, function (name, value) {
// value is a vec2 sampled from the curves
});

Inherited from

AnimationPropertyTrack.createVec2FromCurves


createVec3FromCurves()

static createVec3FromCurves(x, y, z): AnimationPropertyTrack

Creates a Vec3CurvePropertyTrack. Stores and samples explicit curves.

Parameters

Returns

AnimationPropertyTrack

Since

Lens Scripting Version 333

Inherited from

AnimationPropertyTrack.createVec3FromCurves


createVec4FromCurves()

static createVec4FromCurves(x, y, z, w): AnimationPropertyTrack

Creates a Vec4CurvePropertyTrack. Stores and samples explicit curves.

Parameters

Returns

AnimationPropertyTrack

Since

Lens Scripting Version 381

Example

var xCurve = AnimationCurve.createEasingCurve(0.0, 0.0, 0.83, 0, 0.17, 1);
var yCurve = AnimationCurve.createEasingCurve(0.0, 0.0, 0.83, 0, 0.17, 1);
var zCurve = AnimationCurve.createEasingCurve(0.0, 0.0, 0.83, 0, 0.17, 1);
var wCurve = AnimationCurve.createEasingCurve(0.0, 1.0, 0.83, 0, 0.17, 1);
var track = AnimationPropertyTrack.createVec4FromCurves(xCurve, yCurve, zCurve, wCurve);

var layer = AnimationPropertyLayer.create();
layer.setCustomProperty("tintColor", track, function (name, value) {
// value is a vec4 sampled from the curves
});

Inherited from

AnimationPropertyTrack.createVec4FromCurves


getTypeName()

static getTypeName(): TypeName<QuatSlerpAnimationPropertyTrack>

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<QuatSlerpAnimationPropertyTrack>

Since

Lens Scripting Version 381

Overrides

AnimationPropertyTrack.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

AnimationPropertyTrack.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

AnimationPropertyTrack.isOfType


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

ParameterType
otherScriptObject

Returns

boolean

Inherited from

AnimationPropertyTrack.isSame


removeKeyFrame()

removeKeyFrame(t): void

Interface function for typed property tracks.

Parameters

ParameterType
tnumber

Returns

void

Inherited from

AnimationPropertyTrack.removeKeyFrame