TimelineBoolTrack

EntityTimelineTrackceramic.TimelineBoolTrack (Class)

A timeline track that animates boolean values.

TimelineBoolTrack manages a sequence of boolean keyframes to control properties that can be either true or false. Unlike numeric tracks, boolean tracks don't interpolate - they instantly switch values when the timeline position reaches or passes a keyframe.

Common uses:

  • Toggling visibility (visible property)
  • Enabling/disabling features or behaviors
  • Triggering state changes at specific times
  • Creating on/off patterns for effects

Example usage:

var track = new TimelineBoolTrack();
track.add(new TimelineBoolKeyframe(false, 0, NONE));
track.add(new TimelineBoolKeyframe(true, 30, NONE));
track.add(new TimelineBoolKeyframe(false, 45, NONE));

// Listen for value changes
track.onChange(this, t -> {
    myObject.visible = t.value;
});

// Add to timeline
timeline.add(track);

Instance Members

value: Bool

The current boolean value of this track. Updated automatically as the timeline plays based on keyframe positions. Default is false.


apply(?forceChange: Bool = false): Void

Apply the current timeline position to update the boolean value.

Boolean tracks use a simple rule:

  • If between keyframes, use the value of the "before" keyframe
  • If exactly at a keyframe, use that keyframe's value
  • If before all keyframes, use the first keyframe's value
  • If after all keyframes, use the last keyframe's value
Name Type Default Description
forceChange Bool false If true, triggers the change event even if value hasn't changed

new(): Void

Private Members

emitChange(track: TimelineBoolTrack): Void

Event triggered when the boolean value changes. Fired when the track's value switches between true and false.

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