Tweening animation engine for GameMaker LTS 2026
Tweeny is a tweening engine made for GameMaker, featuring a fluent chainable API, fire-and-forget use, more than 50 easing modes, sequential and parallel step execution, and flexible interpolation for variables, colors, angles, strings, and custom methods.
-
Create a tween instance and chain steps together:
// Create a new tween t = new Tweeny(); // Animate a variable over 2 seconds t.Variable(id, "x", 300, 2);
-
Use the fluent API to configure steps inline:
// Chain multiple steps with easing t.Variable(id, "x", 300, 1).SetEaseCurve(TWEENY_EASE_BOUNCE, TWEENY_CHANNEL_OUT); t.Variable(id, "y", 400, 1).SetEaseCurve(TWEENY_EASE_ELASTIC, TWEENY_CHANNEL_OUT);
-
Run steps in parallel for simultaneous animations:
// Move X and Y at the same time t.ParallelBegin(); t.Variable(id, "x", 300, 1); t.Variable(id, "y", 400, 1); t.ParallelEnd();
-
Set loops, callbacks, and control playback:
t.Variable(id, "x", 300, 1) t.Variable(id, "x", 100, 1) t.SetLoops(3).OnFinished(function() { show_debug_message("Animation complete!"); }) // Control playback t.Pause(); t.Play(); t.Skip(); // Jump to end
12 easing curves are available via macros, each with In, Out, InOut, and OutIn channels:
// Set easing on the whole tween
t.SetEaseCurve(TWEENY_EASE_BOUNCE, TWEENY_CHANNEL_OUT)
t.Variable(id, "x", 500, 1)
// Or per-step
t.Variable(id, "x", 500, 1).SetEaseCurve(TWEENY_EASE_ELASTIC, TWEENY_CHANNEL_IN)Color and angle tweens handle their types automatically:
// Fade a color
t.Color(id, "colour", c_red, 1);
// Rotate with shortest angle path
t.Angle(id, "image_angle", 720, 2);Animate strings by interpolating character ordinals:
t.String(id, "caption", "HELLO WORLD", 1);Animate arbitrary values through a callback function:
t.Method(function(value) {
audio_set_gain(snd_music, value, 0);
}, 0, 1, 2).SetEaseCurve(TWEENY_EASE_SINE, TWEENY_CHANNEL_IN);Target values relative to the current value:
t.Variable(id, "x", 200, 1).Relative();Override the starting value of a step:
t.Variable(id, "x", 500, 1).From(0);Add delays between steps or wait without animation:
t.Variable(id, "x", 300, 2);
t.Interval(1); // Wait 1 second
t.Variable(id, "y", 400, 2);Loop animations a finite number of times or infinitely:
// Infinite loop
t.Variable(id, "x", 500, 1);
t.Variable(id, "x", 100, 1);
t.SetLoops();
// Loop 5 times
t.SetLoops(5);
// Listen for loop completions
t.OnLoopFinished(function() {
show_debug_message("Loop finished!");
});Provide your own lerp function for a step:
t.Variable(id, "x", 500, 1).SetInterpolate(customLerp);Manage all tweens at once:
TweenyPauseAll();
TweenyResumeAll();
TweenyStopAll();
TweenyFinishAll();
// Get all active tweens
var all = TweenyGetAll();Sets the global timescale used by every tween:
TweenySetTimescale(1.0);Creates a new tween chain. Optional source instance - the tween auto-destructs if the source is destroyed. Leave undefined if the tween is inside a struct or script
Variable(instance, variable, target, duration)- Animate any numeric variableColor(instance, variable, target, duration)- Animate a colour variableAngle(instance, variable, target, duration)- Animate an angle (shortest path)String(instance, variable, target, duration)- Animate a string variableMethod(func, from, to, duration)- Animate via custom callback (receives interpolated value)Interval(duration)- Wait/pause for a durationCallback(func, [args])- Execute a function mid-sequenceAwait(func, [args])- Awaits for atruereturn from the signal function
SetEaseCurve(animCurve, [channel])- Set per-step easing curveSetEaseFunc(easeFunc)- Set per-step easing functionSetDelay(value)- Delay before the step executes (in frames)SetInterpolate(func)- Custom interpolation function (val1, val2, amount)Relative()- Make the target value relative to currentFrom(value)- Override the starting valueFromCurrent()- Explicitly snap the from value to the current value
ParallelBegin()- Start parallel step groupParallelEnd()- End parallel step group
SetSpeed(scale)- Set playback speed multiplierSetLoops([loops])- Set loop count (0 = infinite, 1 = default)SetEase(animCurve, [channel])- Set global easing for all stepsSkip()- Jump to the end immediatelyPause()- Pause the tweenPlay()- Resume the tweenStop()- Pause and reset to beginningFinish()- Finishes the tweenExecute()- Start the tween
IsRunning()- Check if the tween is actively playingIsPaused()- Check if the tween is pausedIsValid()- Check if the tween is validGetLoops()- Get total loop countGetLoopsLeft()- Get remaining loopsGetElapsedTime()- Get elapsed time
OnFinished(callback)- Called when all steps and loops finishOnLoopFinished(callback)- Called at the end of each loopOnStepFinished(callback)- Called when an individual step completes
TweenySetTimescale(dt)- Override the global timescaleTweenyPauseAll()- Pause all active tweensTweenyResumeAll()- Resume all paused tweensTweenyStopAll()- Stop all tweensTweenyFinishAll()- Finishes all the tweensTweenyDestroyAll()- Destroy all the tweensTweenyGetAll()- Get an array of all active tweens
TWEENY_EASE_STEP,TWEENY_EASE_LINEAR,TWEENY_EASE_SINE,TWEENY_EASE_QUAD,TWEENY_EASE_CUBIC,TWEENY_EASE_QUART,TWEENY_EASE_QUINT,TWEENY_EASE_EXPO,TWEENY_EASE_CIRC,TWEENY_EASE_BACK,TWEENY_EASE_BOUNCE,TWEENY_EASE_ELASTIC,TWEENY_EASE_SPRING
TWEENY_CHANNEL_IN,TWEENY_CHANNEL_OUT,TWEENY_CHANNEL_IN_OUT,TWEENY_CHANNEL_OUT_IN
