TimelineFloatArrayTrack
A timeline track that animates arrays of floating-point values.
TimelineFloatArrayTrack enables simultaneous animation of multiple numeric values, with each array element interpolated independently. This is ideal for animating multi-dimensional data where all components need to change together in a coordinated way.
Key features:
- Element-wise interpolation with easing
- Dynamic array length handling
- Efficient change detection
- Support for arrays of different lengths (uses minimum length)
Common uses:
- 2D/3D position animations ([x, y] or [x, y, z])
- Multi-channel color animations ([r, g, b, a])
- Vertex/shape morphing animations
- Complex parameter sets for effects
- Any synchronized multi-value animation
Example usage:
var track = new TimelineFloatArrayTrack();
// Animate a 2D path
track.add(new TimelineFloatArrayKeyframe([0, 0], 0, LINEAR));
track.add(new TimelineFloatArrayKeyframe([100, 0], 15, EASE_IN));
track.add(new TimelineFloatArrayKeyframe([100, 100], 30, EASE_OUT));
track.add(new TimelineFloatArrayKeyframe([0, 100], 45, EASE_IN));
track.add(new TimelineFloatArrayKeyframe([0, 0], 60, EASE_OUT));
track.onChange(this, t -> {
myObject.x = t.value[0];
myObject.y = t.value[1];
});
timeline.add(track);
Note: For best results, all keyframes should have arrays of the same length.
Instance Members
The current interpolated array of float values. Updated automatically as the timeline plays, with each element smoothly transitioning based on keyframes and easing. Default is an empty array.
Apply the current timeline position to update the float array.
Performs element-wise interpolation:
- Each array element is interpolated independently
- Handles arrays of different lengths (uses minimum length)
- Efficiently tracks changes to avoid unnecessary updates
- Applies easing to each element's interpolation
Name | Type | Default | Description |
---|---|---|---|
forceChange |
Bool | false |
If true, triggers the change event even if no values changed |
new(): Void
Private Members
emitChange(track: TimelineFloatArrayTrack): Void
Event triggered when any value in the array changes. Fired whenever one or more elements are different from the previous frame.
Name | Type | Description |
---|---|---|
track |
TimelineFloatArrayTrack | This track instance (for convenience in handlers) |
Metadata
Name | Parameters |
---|---|
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |