TimelineColorTrack

EntityTimelineTrackceramic.TimelineColorTrack (Class)

A timeline track that animates color values with smooth interpolation.

TimelineColorTrack manages a sequence of color keyframes to create smooth color transitions over time. Colors are interpolated in RGB space, with support for all standard easing functions.

Common uses:

  • Animating object colors (tint, background, text)
  • Creating color fade effects
  • Mood transitions in scenes
  • UI state color changes
  • Particle color animations

Example usage:

var track = new TimelineColorTrack();

// Create a rainbow animation
track.add(new TimelineColorKeyframe(Color.RED, 0, LINEAR));
track.add(new TimelineColorKeyframe(Color.ORANGE, 10, LINEAR));
track.add(new TimelineColorKeyframe(Color.YELLOW, 20, LINEAR));
track.add(new TimelineColorKeyframe(Color.GREEN, 30, LINEAR));
track.add(new TimelineColorKeyframe(Color.BLUE, 40, LINEAR));
track.add(new TimelineColorKeyframe(Color.PURPLE, 50, EASE_IN_OUT));

// Apply color changes to a visual
track.onChange(this, t -> {
    myVisual.color = t.value;
});

timeline.add(track);

Instance Members

value: Color

The current interpolated color value. Updated automatically as the timeline plays, smoothly transitioning between keyframe colors based on position and easing. Default is WHITE.


apply(?forceChange: Bool = false): Void

Apply the current timeline position to update the color value.

Performs smooth color interpolation between keyframes:

  • Between keyframes: Interpolates RGB values using the easing function
  • Before first keyframe: Uses the first keyframe's color
  • After last keyframe: Uses the last keyframe's color

The interpolation uses the "after" keyframe's easing function to determine how the transition occurs.

Name Type Default Description
forceChange Bool false If true, triggers the change event even if color hasn't changed

new(): Void

Private Members

emitChange(track: TimelineColorTrack): Void

Event triggered when the color value changes. Fired whenever the interpolated color is different from the previous frame.

Name Type Description
track TimelineColorTrack 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()