Skip to main content
OpenTUI includes a comprehensive timeline animation system for creating smooth, synchronized animations. Animate any numeric property with easing functions, loops, and nested timelines.

Quick Start

Create a simple animation in just a few lines:

Creating Timelines

Basic Timeline

Timeline Control

Adding Animations

Animating Properties

Animate any numeric properties on JavaScript objects:

Multiple Targets

Animate multiple objects together:

Easing Functions

Control animation curves with easing functions:
Available easing functions:
  • linear - Constant speed
  • inQuad, outQuad, inOutQuad - Quadratic
  • inExpo, outExpo - Exponential
  • inOutSine - Sinusoidal
  • outBounce, inBounce - Bouncing
  • outElastic - Elastic spring
  • inCirc, outCirc, inOutCirc - Circular
  • inBack, outBack, inOutBack - Overshoot

Looping Animations

Basic Looping

Alternating Loops

Reverse direction on each loop:

Loop Delay

Add delay between loops:

Timeline Callbacks

Animation Callbacks

Timeline-wide Callbacks

Function Calls

Execute functions at specific times:

Sequencing Animations

Sequential Animations

Run animations one after another:

Overlapping Animations

Nested Timelines

Sync multiple timelines together:

Dynamic Animations

One-Time Animations

Add animations that run once and are removed:

Updating Timeline

Update timeline manually (useful without renderer.start()):

Complete Examples

Animated Box

Color Fade

Progress Bar

Alternating Movement

Integration with Renderer

Timelines automatically integrate with the renderer’s frame loop:

Performance Tips

Always round values when applying to renderables:
Too many animations can affect performance:
Complex easing functions (elastic, bounce) are more expensive:

Next Steps

3D Rendering

Render 3D graphics with WebGPU

Syntax Highlighting

Add tree-sitter syntax highlighting