Timeline Engine
A scrubbable timeline of keyframe clips at offset start times, driven by a clock or a scroll position.
v0.1.3@magic-spells/timeline-engine
$ npm i @magic-spells/timeline-engineLive demo
stars
clouds
mortar
flash
sparks
sparks
gravity
gravity
Your cursor is the playhead.
About
Scrubable animation timeline for the magic-spells ecosystem. Place keyframe clips at offset start times on one time axis, then let anything drive the playhead — the clock, a scrub position, or the scroll bar.
Usage
import { timeline } from '@magic-spells/timeline-engine';
const tl = timeline();
tl.tween(
'.hero',
{
0: { opacity: '0', transform: 'translateY(40px)' },
100: { opacity: '1', transform: 'translateY(0px)' },
},
{ at: 0, duration: 1000, easing: 'ease-out' }
)
.tween('.card', { 0: { opacity: '0' }, 100: { opacity: '1' } }, { at: 400, duration: 800, stagger: 120 })
.label('finale')
.fromTo('.badge', { transform: 'scale(0)' }, { transform: 'scale(1)' }, { at: 'finale', easing: 'back-out' });
tl.seek(650); // jump the playhead to 650ms — styles applied
tl.getFrames(650); // …or just ask: [{ element, styles }], no DOM writes
tl.progress(0.5); // seek by fraction
await tl.play(); // or play it like an animationAbout, features, usage and options are taken from the package README.