util.easing.elastic_out

Shared

Applies an elastic ease-out — overshoots and oscillates before settling at the end value


Syntax

local result = util.easing.elastic_out(
    progress,
    amplitude = 1.0,
    period = 0.3
)

Elastic easing simulates a spring or rubber-band effect.

  • amplitude — controls the oscillation scale. period — controls the oscillation frequency.
  • Best for — springy UI reveals, bouncy object placements, and effects that should feel alive or physical.

Parameters

TypeNameDescription
floatprogressInterpolation factor, typically in the range [0, 1]
floatamplitudeOscillation scale. Values below 1.0 are clamped to 1.0.
floatperiodOscillation frequency. Smaller = faster oscillation.

Returns

TypeNameDescription
floatresultEased progress value

Examples

Sample output at key progress values
core.engine.print("info", util.easing.elastic_out(0.0))  -- 0.0
core.engine.print("info", util.easing.elastic_out(0.25)) -- near start
core.engine.print("info", util.easing.elastic_out(0.5))  -- midpoint
core.engine.print("info", util.easing.elastic_out(0.75)) -- near end
core.engine.print("info", util.easing.elastic_out(1.0))  -- 1.0
Pair with lerp to animate a value
local result = util.easing.lerp(0, 100, util.easing.elastic_out(0.5))

core.engine.print("info", result)
Animate a circle across the screen
local resolution = core.engine.get_resolution()
local duration = 1.5
local start_tick = core.engine.get_tick()

util.event.on("sandbox:draw", function()
    local elapsed = (core.engine.get_tick() - start_tick) / 1000.0
    local t = math.min(elapsed / duration, 1.0)
    local x = util.easing.lerp(0, resolution[1], util.easing.elastic_out(t))

    core.engine.draw_circle({x, resolution[2]*0.5}, 16, {1, 1, 1, 1})
end)

On this page