Skip to content

Easing Functions

Easing functions make animations look smooth. FoundryEngine includes 31 Penner easing functions plus CSS-style cubic bezier easings.

How easing works

All easings use the same formula:

groovy
float result = Easing.SINE_IN_OUT.ease(elapsedTime, minValue, maxValue, totalDuration)

Where elapsedTime goes from 0 to totalDuration, and the result is the eased value between min and max.

Quick list

ConstantEffect
LINEARConstant speed, no easing
QUAD_INSlow start, fast end
QUAD_OUTFast start, slow end
QUAD_IN_OUTSlow start and end
CUBIC_IN / CUBIC_OUT / CUBIC_IN_OUTStronger versions of quad
SINE_IN / SINE_OUT / SINE_IN_OUTSmooth sinusoidal
EXPO_IN / EXPO_OUTVery dramatic
ELASTIC_IN / ELASTIC_OUTBouncy, overshoots
BOUNCE_IN / BOUNCE_OUTLike a bouncing ball
BACK_IN / BACK_OUTOvershoots slightly then settles

Bezier easing

CSS-style cubic bezier:

groovy
BezierEasing.EASE        // (0.25, 0.1, 0.25, 1.0)
BezierEasing.EASE_IN     // (0.42, 0.0, 1.0, 1.0)
BezierEasing.EASE_OUT    // (0.0, 0.0, 0.58, 1.0)
BezierEasing.EASE_IN_OUT // (0.42, 0.0, 0.58, 1.0)

// Custom
new BezierEasing("custom", 0.1, 0.8, 0.2, 1.0)

Usage in builders

groovy
builder.color(Color.RED, Color.BLUE, Easing.CUBIC_IN_OUT)
builder.rotation(0f, (float)Math.PI * 2, Easing.ELASTIC_OUT)
// Note: for scale transitions, use scaleData with a KeyframeSequence

Usage in keyframes

groovy
new ParticleScaleData(new KeyframeSequence<Float>()
    .add(0.5f, 0f, Easing.LINEAR)
    .add(2.0f, 0.5f, Easing.BOUNCE_OUT)
    .add(0.0f, 1f, Easing.LINEAR))

Where easing is used

  • Particles — color, scale, position over lifetime
  • Cutscenes — camera path interpolation
  • Post-Processing — screen effect transitions

Next

FoundryEngine is a work-in-progress. Documentation may change.