Free and open source
OPEN SOURCERY
Frameworks, interface components, motion engines, and developer tools that solve real problems simply.
Animation
Split Text
Text that makes an entrance.
A web component that splits text into words, characters, or lines and animates each piece in turn.
- Splits by word, character, or line, measured from the real layout
- Eight effects, all pure CSS
- Links and emphasis inside the text survive the split
$ npm i @magic-spells/split-textEffect
<split-text effect="rise" split="chars">Scroll
Scroll Progress
Scroll position, as a CSS variable.
A web component that measures how far an element has travelled through the viewport and writes it to a custom property. The animation stays in your CSS.
- Playhead anchors set where progress starts and ends, by keyword or percentage
- A second variable carries scroll velocity, eased back to zero
- One shared frame loop for every instance, idle while nothing moves
$ npm i @magic-spells/scroll-progress.tick { rotate: calc(var(--scroll-progress) * var(--i) * 3deg); }
.number { transform: skewX(calc(var(--scroll-progress-velocity) * -0.8deg)); }Motion
Timeline Engine
Choreography you can scrub.
Build a timeline from keyframed tweens, then seek, scrub, reverse, or tie the playhead to scroll. The same time always renders the same frame, however you got there.
- Keyframed tweens with labels, stagger, and fill modes
- Drive the playhead from a clock or the scroll position
- Set a negative timeScale to play it in reverse
$ npm i @magic-spells/timeline-engineMotion
Morph Engine
Interfaces that morph into each other.
A spring-driven morph between two elements. It flies the size, corners, background, border, and shadow of what you clicked into the target.
- Spring timing, so overshoot becomes a natural bounce
- Interrupt it and it reverses from wherever it is
- Adjust attraction and friction mid-flight
$ npm i @magic-spells/morph-engineClick a box to see it in action.
Scroll
Reveal
Animate anything in as you scroll.
Two classes on an element are all it takes. The hidden states live in the stylesheet, so nothing flashes before the script arrives.
- Thirty-two effects: fades, slides, flips, zooms, and blooms
- Stagger groups cascade whatever arrives together
- Delay, duration, and easing are classes too
$ npm i @magic-spells/reveal<div class="reveal reveal-bloom-in-up" data-reveal-group="tiles:50">Dialog panels
Sheet
A bottom sheet on mobile, a drawer on the desktop.
Built on the native dialog element, so focus trapping, Escape, and the backdrop come from the browser.
Desktop placement
Snap points
Mode
- Five placements: top, bottom, left, right, or a centered card
- Cross the breakpoint while open and it morphs in place
- Snap points: a flick settles at the nearest height
$ npm i @magic-spells/sheetDialog panels
Panel Stack
Drill down without losing your place.
Nested panels for mobile menus, settings, and wizards. The stack handles motion, focus, and Escape, and your app keeps the state.
magic-spells
Everything we ship
Three levels deep, zero unmounts.
Open source
Pick a package to look inside.
Puzzle Pieces
Copied into your app as readable source.
Panel Stack
The piece rendering this menu.
- Parent owns the stack array
- Escape pops one level
- Focus returns to the trigger
- Panels never unmount, so their state survives navigation
- Push and pop buttons work by delegation, with no wiring per panel
- Focus follows the stack and returns on the way back
$ npm i @magic-spells/panel-stack