Property animation
Composer ships with two animation systems. Most new code should use Project.AddPropertyAnimator — it animates any numeric property on any object in the project, addressed either by name or by direct reference. The older Project.Animator.AddLayerTransformationItem is limited to a fixed set of layer transform fields.
| Function | Returns | Description |
|---|---|---|
Animator.AddLayerTransformationItem(sceneName: string, layerName: string, type: Animator.AnimateTransform, durationMs: int, startValue: float, stopValue: float, cData: string, mode?: Animator.AnimateEasing, options?: Animator.AnimateOptions) |
Guid |
Legacy. Animates one of eight fixed LayerTransform fields. New scripts should prefer AddPropertyAnimator. |
ClearAllPropertyAnimations() |
void |
Stops every running property animation at once, leaving each animated property at whatever value it had reached. Nothing is rewound. |
IsPropertyBeingAnimated(objectName: string, propertyName: string) |
bool |
Whether a property is currently being animated on the named object — the name-addressed form. False when the object cannot be resolved, so it is also a "nothing is running on that" answer rather than an error. |
IsPropertyBeingAnimated(target: object, propertyName: string) |
bool |
Whether a property is currently being animated on the given object. The object-addressed counterpart of the name-addressed overload, for targets outside NamedModels, which have no name to address them by. |
RemovePropertyAnimation(id: Guid) |
bool |
Stops one running animation, identified by the Guid its AddPropertyAnimator call returned. The property keeps the value it had reached. Returns false when no animation with that id is running — which is also the case once it has finished on its own. |
GetNumberOfRunningPropertyAnimations() |
int |
How many property animations are running right now, across every object in the project. Useful for waiting until a cue has finished before starting the next one. |
AddPropertyAnimator(objectName: string, propertyName: string, startValue: object, targetValue: object, durationMs: float, easing: Enums.AnimationEasing, behavior?: Enums.RunningAnimationBehavior) |
Guid |
Animates a numeric property (int/byte/uint/long/float/double) on a named model. Pass null for startValue to animate from the property's current value. Returns Guid.Empty on failure (ambiguous name, missing property, read-only, non-numeric). |
AddPropertyAnimator(target: object, propertyName: string, startValue: object, targetValue: object, durationMs: float, easing: Enums.AnimationEasing, behavior?: Enums.RunningAnimationBehavior) |
Guid |
Animates a numeric property on an object REFERENCE rather than a name — the form that reaches objects that are not named models. Pass null for startValue to animate from the property's current value. Returns Guid.Empty on failure (missing property, read-only, non-numeric). |
AddPropertyAnimator has two overloads, differing only in how the target is addressed.
Notes that apply to both:
- The property must be writable and numeric —
int,byte,uint,long,float, ordouble. Read-only or non-numeric properties are rejected. Aboolis not animatable: there are no values betweenfalseandtrueto pass through. - The property name is matched case-sensitively.
- Pass
nullforstartValueto animate from the property's current value. - Returns the animation's
Guid, orGuid.Emptyon failure (logged).
By name — AddPropertyAnimator(objectName, ...):
- The target is looked up by name in
NamedModels: inputs, scenes, layers, layer transforms, layer audio, operators, scene targets and property bindings. If the name is ambiguous the call fails and returnsGuid.Empty. - For a
Layer, the property is first searched onLayeritself, then onLayer.LayerTransform(so"PositionX"and"Opacity"work directly with the layer name). - The animation is retired automatically if its target leaves the project.
By reference — AddPropertyAnimator(target, ...):
- Takes the object itself, which is what reaches anything outside
NamedModels— an object the script already holds a reference to rather than a name. - Because the caller holds the reference, there is no lookup to fall back on and therefore no automatic retirement: the animation runs for its full duration regardless of what happens to the object. Use
RemovePropertyAnimationorClearAllPropertyAnimationsto stop one early. (The dedicated 3D helpers below do not have this caveat — they supply their own liveness rule.)
// by name — a layer, which is a named model
Project.AddPropertyAnimator("Logo", "PositionX", null, 400, 2000, Enums.AnimationEasing.EaseInOut);
Example: fade-in then move
var Enums = importNamespace('VindralEngineBaseTypes.DataTypes.Enums');
function OnConnectorIntro() {
// Fade opacity 0 → 100 over 500 ms (linear)
Project.AddPropertyAnimator("Logo", "Opacity", 0, 100, 500, Enums.AnimationEasing.None);
// Slide to X=400 over 2 s, easing in/out — start from current X
Project.AddPropertyAnimator("Logo", "PositionX", null, 400, 2000, Enums.AnimationEasing.EaseInOut);
}
RunningAnimationBehavior
| Value | Meaning |
|---|---|
CancelNewAnimation |
If an animation already exists on the same property, drop the new one. |
AbortRunningAnimations (default) |
Cancel any running animations on the same property and start the new one. |
AllowMultipleAnimations |
Stack the new animation alongside existing ones. Not recommended — the property's final value depends on which animation finishes last. |
AnimationEasing
| Value | Curve |
|---|---|
None |
Linear interpolation. |
EaseInOut |
Smoothstep (3t² − 2t³). |
AddPropertyAnimator takes this as the enum (Enums.AnimationEasing.EaseInOut).
Legacy: AnimatorEngine.AddLayerTransformationItem
Project.Animator.AddLayerTransformationItem is the older animation API. It only animates the eight layer-transform fields below and uses its own enum set. New scripts should prefer AddPropertyAnimator.
Project.Animator.AddLayerTransformationItem(
sceneName,
layerName,
type, // Animator.AnimateTransform.*
durationMs,
startValue,
stopValue,
cData, // free-form string, currently unused
mode, // Animator.AnimateEasing.* (default EaseInEaseOut)
options // Animator.AnimateOptions.* (default None)
) → Guid
AnimateTransform |
|---|
PositionX, PositionY, ScaleX, ScaleY, AnchorPointX, AnchorPointY, Rotation, Opacity |
AnimateEasing |
Curve |
|---|---|
Linear |
|
EaseInEaseOut (default) |
Smoothstep |
AnimateOptions |
Meaning |
|---|---|
None |
Use the supplied startValue. |
UseCurrentValueAsInitialValue |
Ignore startValue; capture the property's current value when the animation starts. |
var Animator = importNamespace('VindralEngine').Animator;
Project.Animator.AddLayerTransformationItem(
"Scene", "Tant",
Animator.AnimateTransform.PositionY,
1500, 866.805, 381.805, "",
Animator.AnimateEasing.EaseInEaseOut,
Animator.AnimateOptions.None);