TimelineFloatTrack

EntityTimelineTrackceramic.TimelineFloatTrack (Class)

A timeline track that animates floating-point values with smooth interpolation.

TimelineFloatTrack is one of the most versatile track types, capable of animating any numeric property. It supports all easing functions for creating natural, dynamic animations.

Common uses:

  • Position animations (x, y coordinates)
  • Scale transitions (scaleX, scaleY)
  • Rotation animations (rotation in degrees)
  • Alpha/opacity fades
  • Size changes (width, height)
  • Any custom numeric property

Example usage:

var track = new TimelineFloatTrack();

// Animate position from 0 to 500 with easing
track.add(new TimelineFloatKeyframe(0, 0, LINEAR));
track.add(new TimelineFloatKeyframe(200, 30, EASE_IN));
track.add(new TimelineFloatKeyframe(500, 60, ELASTIC_EASE_OUT));

// Apply changes to an object property
track.onChange(this, t -> {
    myObject.x = t.value;
});

timeline.add(track);

The track smoothly interpolates between keyframe values based on:

  • The timeline position
  • The easing function of the "after" keyframe
  • The distance between keyframes

Instance Members

value: Float

The current interpolated float value. Updated automatically as the timeline plays, smoothly transitioning between keyframe values based on position and easing. Default is 0.0.


apply(?forceChange: Bool = false): Void

Apply the current timeline position to update the float value.

Performs smooth numeric interpolation between keyframes:

  • Between keyframes: Interpolates using the "after" keyframe's easing function
  • Before first keyframe: Uses the first keyframe's value
  • After last keyframe: Uses the last keyframe's value

The interpolation formula is:

value = before.value + (after.value - before.value) * easedRatio
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: TimelineFloatTrack): Void

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

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