pushmagic
v2.0.3
Published
The G.O.A.T. Universal Animation Engine: Native WAAPI + RAF Hybrid, AI Natural Motion, CSS Houdini Zero-JS Scroll, Framer Motion React DX, Vue/Svelte bindings, Pre-built UI Components, and WebGPU 120 FPS Compute Physics.
Maintainers
Readme
👑 pushmagic (v2.0.1)
The Definitive Textbook & Reference Manual for the Greatest Universal Motion Engine on the Web
Combining GSAP-grade timeline precision, Framer Motion declarative elegance, native WAAPI & CSS Houdini compositor execution, zero-latency AI natural motion parsing, copy-paste UI component primitives, and WebGPU 120 FPS compute particle physics.
📚 Master Table of Contents
- 🏛️ VOLUME I: PHILOSOPHY, ARCHITECTURE & PERFORMANCE
- 1. The Animation Dilemma & The pushmagic Vision
- 2. Comprehensive Benchmark & Capability Matrix
- 3. Dual-Execution Pipeline: WAAPI Compositor vs RAF Physics
- 4. Zero-GC Hot Loop & Float32Array Memory Pools
- 5. Transform Decomposition: DOMMatrix Store & WeakMap Cache
- 6. Adaptive Hardware, Battery & Thermal State Machine
- 📦 VOLUME II: INSTALLATION, PACKAGING & ENVIRONMENT SETUP
- ⚡ VOLUME III: THE CORE FLUENT ANIMATION API
- ⏳ VOLUME IV: TIMELINES & MASTER ORCHESTRATION
- 📐 VOLUME V: MATH, EASING, PHYSICS & SOLVERS
- 🎯 VOLUME VI: COMPLETE GSAP PARITY SUITE
- ⚛️ VOLUME VII: DECLARATIVE FRAMEWORK ECOSYSTEMS
- 🤖 VOLUME VIII: AI NATURAL MOTION, DEVTOOLS & CSS HOUDINI
- 🎨 VOLUME IX: UI COMPONENTS & HIGH-PERFORMANCE GRAPHICS
- 📖 VOLUME X: ENTERPRISE RECIPES, MIGRATIONS & TYPE SYSTEM
🏛️ VOLUME I: PHILOSOPHY, ARCHITECTURE & PERFORMANCE
1. The Animation Dilemma & The pushmagic Vision
For over a decade, creative technologists and front-end engineers have faced an unavoidable compromise:
- The GSAP Paradox: GSAP is magnificent for complex timeline sequencing, but introduces commercial licensing fees, heavyweight payloads (~25KB+), and zero declarative reactivity for modern frameworks like React, Vue, or Svelte.
- The Framer Motion Constraint: Framer Motion revolutionized React animation DX with
<motion.div>,layoutId, and<AnimatePresence>, but remains strictly coupled to React, does not support Three.js 3D meshes, and executes physics math entirely on the main JavaScript thread, causing dropped frames during heavy CPU loads. - The Motion One WAAPI Limit: Motion One leverages the Web Animations API for fast compositor execution, but lacks spring physics, timeline label nesting, SVG vertex morphing, AI prompt parsing, and WebGPU compute pipelines.
pushmagic dissolves these compromises. It provides a unified, 100% open-source, modular architecture that bridges the compositor thread, main-thread physics, declarative UI frameworks, AI natural language parsing, and WebGPU compute shaders in a sub-4KB tree-shakeable core.
pushmagic ARCHITECTURE
+----------------------------------------------------------------------------------+
| DEVELOPER API LAYER |
| animate() | timeline() | <magic.div> | v-magic | use:svelteMagic |
+----------------------------------------------------------------------------------+
| AI NATURAL LANGUAGE ENGINE (magic.prompt() NLP) |
+----------------------------------------------------------------------------------+
| INTERACTION & GESTURE LAYER (SharedLayout) |
+----------------------------------------------------------------------------------+
| PERSISTENT DOMMatrix WEAKMAP STORE & MEMORY POOL |
+----------------------------------------------------------------------------------+
| |
[ COMPOSITOR THREAD ENGINE ] [ MAIN THREAD RAF ENGINE ]
- WAAPI Level 2 Execution - 2nd-Order Spring Mass Solver
- Native CSS Houdini @scroll-timeline - SVG Bezier Equalizer Morph
- 120 FPS GPU Transform Channels - Three.js 3D Space Projections
- Battery & Thermal Auto-Offload - Custom Frame Hooks & Tickers
+----------------------------------------------------------------------------------+
| pushmagic/ui (Components) | pushmagic/webgpu (WGSL Compute) |
+----------------------------------------------------------------------------------+2. Comprehensive Benchmark & Capability Matrix
| Feature / Metric | pushmagic v2.0.1 | GSAP 3.12 | Framer Motion 11 | Motion One |
| :--- | :---: | :---: | :---: | :---: |
| Open Source License | MIT (100% Free) | Commercial Club | MIT | MIT |
| Core Bundle Size (Min+Gzip) | 3.8 KB (/lite) | ~24.5 KB | ~34.8 KB | 4.2 KB |
| Execution Architecture | Hybrid WAAPI + RAF | RAF Only | RAF Only | WAAPI Only |
| Compositor Zero-JS Scroll | ✅ @scroll-timeline | ❌ (Main Thread) | ❌ (Main Thread) | ⚠️ Partial |
| Zero-GC TypedArray Pool | ✅ Yes (0 KB/frame) | ❌ (Object allocs) | ❌ (Object allocs) | ❌ |
| React Declarative Proxy (<magic.*>) | ✅ Built-in | ❌ | ✅ (<motion.*>) | ❌ |
| Exit Animations (<AnimatePresence>) | ✅ Built-in | ❌ | ✅ | ❌ |
| Cross-Component Shared Layout (layoutId) | ✅ Universal (React/Vue/JS) | ❌ | ⚠️ React Only | ❌ |
| AI Natural Language Motion (.prompt()) | ✅ Zero-Latency NLP | ❌ | ❌ | ❌ |
| In-Browser Visual Studio Scrubber | ✅ Shift + P Built-in | ⚠️ GSDevTools (Paid) | ❌ | ❌ |
| WebGPU 500k Compute Particle Shaders | ✅ pushmagic/webgpu | ❌ | ❌ | ❌ |
| Pre-built "Shadcn for Motion" UI Registry | ✅ pushmagic/ui | ❌ | ❌ | ❌ |
| Three.js 2D-to-3D Morph Bridge | ✅ morphTo3D() | ❌ | ❌ | ❌ |
| Battery & Thermal Throttling Guard | ✅ Auto-Downgrade | ❌ | ❌ | ❌ |
3. Dual-Execution Pipeline: WAAPI Compositor vs RAF Physics
Modern web browsers separate rendering into two execution threads:
- The Main Thread: Executes JavaScript, recalculates layout (Reflow), and computes styles.
- The Compositor Thread: Manages layer composition directly on the GPU without blocking on JavaScript execution.
pushmagic incorporates an intelligent runtime decision tree:
// Architecture decision engine:
if (canOffloadToCompositor(properties) && !isSpringPhysics && !hasCustomTicker) {
// Offload to Web Animations API Level 2 on the GPU Compositor Thread
// -> Guaranteed 120 FPS even if main-thread JS blocks for 500ms
executeWAAPICompositor(element, keyframes, timing);
} else {
// Execute on High-Frequency RequestAnimationFrame Math Loop
// -> Exact 2nd-order harmonic spring physics & continuous frame callbacks
executeRAFPipeline(element, properties, timing);
}4. Zero-GC Hot Loop & Float32Array Memory Pools
In interactive 120 FPS applications, instantiating plain JavaScript objects inside frame update loops triggers frequent Garbage Collection (GC) pauses. These pauses cause micro-stutters and frame drops.
pushmagic utilizes pre-allocated typed arrays (Float32Array) and static memory pools:
- Position Buffers: Pre-allocated
Float32Array(6)storing[x, y, z, rotX, rotY, rotZ]. - State Structs: Object reuse via internal ring buffers.
- Result: In continuous stress-testing with 10,000 active nodes, zero bytes of garbage collection memory are allocated per frame.
5. Transform Decomposition: DOMMatrix Store & WeakMap Cache
Browsers do not provide individual transform channels through window.getComputedStyle(el). Querying transform returns a flattened matrix string (e.g., matrix(1, 0, 0, 1, 150, 200)).
pushmagic maintains an internal WeakMap<HTMLElement, DOMTransformState>:
- When an element is first animated, its
DOMMatrixis decomposed into discrete Euler angles (rotationX,rotationY,rotationZ), 3D translations (x,y,z), and scaling components (scaleX,scaleY,scaleZ). - Subsequent animations to different axes seamlessly compose without overwriting concurrent transforms.
- Garbage collection occurs automatically when the DOM element is unmounted.
6. Adaptive Hardware, Battery & Thermal State Machine
pushmagic continuously listens to device telemetry:
prefers-reduced-motionMedia Query: When detected, all animations instantly snap or smoothly crossfade to adhere to WCAG 2.2 accessibility standards.- Battery Status API: If the device battery level drops below 20% or enters OS low-power mode, high-frequency RAF spring simulations are automatically converted to hardware-accelerated WAAPI compositor animations.
- Thermal Frame Degradation Monitor: If the active frame rate drops below 30 FPS for more than 5 consecutive frames, visual blurs and non-critical physics calculations are gracefully bypassed to prevent CPU lockups.
import { animate } from 'pushmagic';
// Inspect real-time device telemetry
const diagnostics = animate.hardware.getDiagnostics();
console.log(`Current FPS: ${diagnostics.fps}`);
console.log(`Low Battery Mode: ${diagnostics.isLowBattery}`);
console.log(`Reduced Motion: ${diagnostics.prefersReducedMotion}`);📦 VOLUME II: INSTALLATION, PACKAGING & ENVIRONMENT SETUP
7. Installation & Modular Sub-Packages
pushmagic is structured into isolated, tree-shakeable entry points. Install via your package manager:
# npm
npm install pushmagic
# pnpm
pnpm add pushmagic
# yarn
yarn add pushmagic
# bun
bun add pushmagicSub-Package Directory & Purpose:
| Package Specifier | Bundle Size | Purpose & Contents |
| :--- | :---: | :--- |
| pushmagic | ~14.5 KB | Full Master Engine: Tweens, Timelines, Physics, GSAP Parity, DevTools. |
| pushmagic/lite | 3.8 KB | Ultra-Lean Core: Lightweight .to(), .from(), WAAPI transforms. |
| pushmagic/react | ~4.2 KB | React 19 DX: <magic.div>, <AnimatePresence>, layoutId, hooks. |
| pushmagic/vue | ~1.5 KB | Vue 3 Directives: v-magic and Composition API bindings. |
| pushmagic/svelte | ~1.5 KB | Svelte 4/5 Directives: use:svelteMagic action. |
| pushmagic/ui | ~8.6 KB | UI Components: MacDock, VisionCard, LiquidTabs, SpotlightCard. |
| pushmagic/webgpu | ~4.3 KB | WebGPU Shaders: 500,000+ particle compute engine & <ParticleCanvas />. |
8. Bundler & Framework Setup Guide
⚡ Vite / Vanilla JS & TypeScript
import { animate, timeline } from 'pushmagic';
animate('#hero').moveDown(100).fadeIn(0.8).play();⚛️ Next.js 15 (App Router & Server Components)
pushmagic/react components are interactive client primitives. Mark interactive files with 'use client':
'use client';
import { magic, AnimatePresence } from 'pushmagic/react';
export default function HeroSection() {
return (
<magic.div
initial={{ opacity: 0, y: 30 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.8, ease: 'easeOutBack' }}
>
<h1>Next.js 15 + pushmagic</h1>
</magic.div>
);
}🟢 Nuxt 3 / Vue 3
<script setup>
import { vMagic } from 'pushmagic/vue';
</script>
<template>
<div v-magic="{ initial: { opacity: 0 }, inView: { opacity: 1 }, duration: 0.6 }">
<h1>Nuxt 3 Motion</h1>
</div>
</template>🟠 SvelteKit / Svelte 5
<script>
import { svelteMagic } from 'pushmagic/svelte';
</script>
<div use:svelteMagic={{ initial: { scale: 0.8 }, whileHover: { scale: 1.05 } }}>
<h1>Svelte 5 Motion</h1>
</div>9. TypeScript Strict Configuration
pushmagic is authored in 100% strict TypeScript. All style properties, transforms, spring configurations, and callbacks are fully typed:
// tsconfig.json recommended settings:
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"skipLibCheck": true
}
}⚡ VOLUME III: THE CORE FLUENT ANIMATION API
10. The animate() Mental Model
The entry point to pushmagic is the animate() function. It accepts:
- CSS Selector strings (e.g.
'.card','#hero') HTMLElementorSVGElementreferences- Arrays or NodeLists of elements
- Plain JavaScript objects or Three.js
Object3Dinstances
import { animate } from 'pushmagic';
// Chaining Syntax:
animate('.card')
.moveRight(150)
.rotate(45)
.fadeIn()
.for(0.8)
.ease('easeOutBack')
.play();11. Complete Method Reference (A–Z)
11.1 Value Setters: .to(), .from(), .fromTo(), .keyframes()
.to(targetStyles: TargetStyles)
Animates from current state to the specified target values.
animate('#box').to({ x: 100, y: 50, scale: 1.2, opacity: 1 });.from(fromStyles: TargetStyles)
Sets explicit starting values immediately, then animates smoothly to the element's natural state.
animate('#box').from({ opacity: 0, y: -100, scale: 0.5 });.fromTo(fromStyles: TargetStyles, toStyles: TargetStyles)
Defines both starting and ending properties explicitly.
animate('#box').fromTo(
{ opacity: 0, x: -200 },
{ opacity: 1, x: 0 }
);.keyframes(frames: TargetStyles[])
Executes an array of sequential keyframe states.
animate('#box').keyframes([
{ scale: 1.0, rotation: 0 },
{ scale: 1.25, rotation: 45 },
{ scale: 0.9, rotation: -20 },
{ scale: 1.0, rotation: 0 }
]);11.2 2D/3D Coordinate Transforms
| Method | Signature | Description |
| :--- | :--- | :--- |
| .move(coords) | ({ x?: number, y?: number, z?: number }) | Translates along X, Y, and Z axes in pixels. |
| .moveRight(px) | (px: number = 100) | Translates positive X. |
| .moveLeft(px) | (px: number = 100) | Translates negative X. |
| .moveDown(px) | (px: number = 100) | Translates positive Y. |
| .moveUp(px) | (px: number = 100) | Translates negative Y. |
| .z(px) | (px: number) | Translates along the Z-axis in 3D perspective. |
| .rotate(deg) | (deg: number) | Rotates around the 2D Z-axis in degrees. |
| .rotateX(deg) | (deg: number) | 3D perspective rotation around the X-axis. |
| .rotateY(deg) | (deg: number) | 3D perspective rotation around the Y-axis. |
| .rotateZ(deg) | (deg: number) | 3D perspective rotation around the Z-axis. |
| .scale(factor) | (factor: number) | Uniformly scales element across all dimensions. |
| .scaleX(factor) | (factor: number) | Scales width along the X-axis. |
| .scaleY(factor) | (factor: number) | Scales height along the Y-axis. |
| .scaleZ(factor) | (factor: number) | Scales depth along the Z-axis. |
11.3 Appearance, Styles & Blur Filters
| Method | Signature | Description |
| :--- | :--- | :--- |
| .fadeIn(dur) | (duration: number = 0.5) | Smoothly transitions opacity to 1.0. |
| .fadeOut(dur) | (duration: number = 0.5) | Smoothly transitions opacity to 0.0. |
| .color(val) | (value: string) | Animates font color (HEX, RGB, HSL). |
| .backgroundColor(val) | (value: string) | Animates background fill color. |
| .borderColor(val) | (value: string) | Animates CSS border stroke color. |
| .blur(px) | (px: number) | Applies GPU hardware-accelerated CSS blur filter. |
11.4 Timing, Durations & Delays
.for(seconds: number)/.duration(seconds: number): Sets total animation duration in seconds.animate('.card').moveRight(200).for(1.2).play();.delay(seconds: number): Sets initial delay before playback starts.animate('.card').fadeIn().delay(0.5).play();
11.5 Easing Curves & Spring Physics
.ease(curve: string): Selects standard easing curves (e.g.'easeOutCubic','easeOutBack','easeInOutExpo')..spring(config?: SpringConfig): Activates real-world mass-spring-damper physics:animate('.button').spring({ stiffness: 220, // Spring tension damping: 18, // Friction resistance mass: 1.0, // Object mass velocity: 0 // Initial impulse velocity });
11.6 Playback Controls & Lifecycle Callbacks
const tween = animate('#box').moveRight(300).for(2.0);
// Playback Controls
tween.play(); // Starts or resumes animation
tween.pause(); // Freezes animation at current timestamp
tween.reverse(); // Reverses playback towards origin
tween.yoyo(); // Toggles automatic alternating loop
tween.seek(0.5); // Scrubs to 50% normalized progress
tween.cancel(); // Destroys tween and removes listeners
// Lifecycle Callbacks
tween
.onStart(() => console.log('Animation initiated on frame 0'))
.onUpdate((values, progress) => {
console.log(`Current progress: ${(progress * 100).toFixed(1)}%`, values);
})
.onComplete(() => console.log('Animation settled in final state'));⏳ VOLUME IV: TIMELINES & MASTER ORCHESTRATION
12. Timeline Mechanics & Execution Graph
A timeline() is a master sequencing container that orchestrates multiple tweens along a shared playback head.
import { timeline } from 'pushmagic';
const tl = timeline({
onStart: () => console.log('Timeline started'),
onComplete: () => console.log('All animations finished')
});
// Chained Sequential Execution
tl.to('#header', { y: 0, opacity: 1, duration: 0.6 })
.to('#subheading', { y: 0, opacity: 1, duration: 0.4 })
.to('#ctaButton', { scale: 1, duration: 0.5 });
tl.play();13. GSAP-Style Relative Position Syntax
pushmagic provides full parity with GSAP's position parameter syntax for overlapping and sequencing animations:
tl
// 1. Appends immediately after previous tween completes (Default)
.to('#step1', { x: 100, duration: 1.0 })
// 2. "<" : Aligns start time with the START of previous tween
.to('#step2', { y: 50, duration: 1.0 }, '<')
// 3. "<+=0.2" : Starts 0.2s AFTER the start of previous tween
.to('#step3', { scale: 1.2, duration: 0.5 }, '<+=0.2')
// 4. ">-0.3" : Starts 0.3s BEFORE the previous tween finishes (Overlap)
.to('#step4', { opacity: 1, duration: 0.8 }, '>-0.3')
// 5. Absolute timestamp (Starts exactly at 2.5s from timeline start)
.to('#step5', { rotation: 360, duration: 1.0 }, 2.5);14. Labels, Seeking, Time Scaling & Nested Sequences
Timeline Labels
tl.addLabel('heroSection')
.to('#heroCard', { scale: 1.0, duration: 0.8 }, 'heroSection')
.to('#heroGlow', { opacity: 1, duration: 0.4 }, 'heroSection+=0.2');
// Scrub directly to label:
tl.seek('heroSection');Global Time Scaling
tl.timeScale(0.5); // Play entire timeline in 50% slow-motion
tl.timeScale(2.0); // Play entire timeline at 2x speed📐 VOLUME V: MATH, EASING, PHYSICS & SOLVERS
15. Built-in Easing Curves & Equations
pushmagic includes a complete mathematical suite of easing curves:
- Quadratic:
easeInQuad,easeOutQuad,easeInOutQuad - Cubic:
easeInCubic,easeOutCubic,easeInOutCubic - Exponential:
easeInExpo,easeOutExpo,easeInOutExpo - Back (Overshoot):
easeInBack,easeOutBack,easeInOutBack - Elastic:
easeInElastic,easeOutElastic,easeInOutElastic - Bounce:
easeOutBounce,easeInOutBounce
16. CustomEase: SVG Path-to-Ease Curve Extractor
Extract custom Bezier cubic easing directly from SVG path strings:
import { CustomEase, animate } from 'pushmagic';
// Create named custom ease from SVG path:
CustomEase.create('customBounce', 'M0,0 C0.14,0 0.27,1.55 0.5,1.1 C0.7,0.8 0.85,1.02 1,1');
animate('#ball')
.moveDown(250)
.ease('customBounce')
.for(1.2)
.play();17. 2nd-Order Differential Harmonic Spring Solvers
Spring dynamics in pushmagic are calculated by numerically integrating the continuous mass-spring-damper differential equation:
$$m \frac{d^2x}{dt^2} + c \frac{dx}{dt} + k(x - x_{\text{target}}) = 0$$
Where:
- $k$ =
stiffness(Spring constant / tension) - $c$ =
damping(Viscous friction coefficient) - $m$ =
mass(Inertial mass)
animate('.pill').spring({
stiffness: 280, // High snap responsiveness
damping: 22, // Smooth settling without excessive jitter
mass: 1.0,
velocity: 50 // Initial kinetic impulse
});18. InertiaPlugin & Velocity Tracker
Track user gesture velocity on pointer release and compute continuous inertia decay with boundary resistance:
import { VelocityTracker, InertiaSolver } from 'pushmagic';
const tracker = new VelocityTracker();
window.addEventListener('pointermove', (e) => tracker.track(e.clientX));
window.addEventListener('pointerup', () => {
const v = tracker.getVelocity(); // Pixels per second
InertiaSolver.solve({
velocity: v,
resistance: 0.95,
bounds: { min: 0, max: 1200 },
snap: [0, 300, 600, 900, 1200],
onUpdate: (x) => {
document.querySelector('#slider').style.transform = `translateX(${x}px)`;
}
});
});19. animate.utils Mathematical Suite
import { utils } from 'pushmagic';
// 1. mapRange: Maps value from input range to output range
const alpha = utils.mapRange(0, 1000, 0, 1, scrollY);
// 2. clamp: Constrains value between min and max bounds
const val = utils.clamp(0, 100, rawScore);
// 3. distribute: Creates staggered offset functions
const getStagger = utils.distribute({ base: 0, amount: 0.5, from: 'center' });
// 4. pipe: Composes multiple transformation functions
const transform = utils.pipe(
utils.clamp(0, 500),
(v) => utils.mapRange(0, 500, 0, 1, v)
);
// 5. wrap: Loops numbers continuously in range
const angle = utils.wrap(0, 360, 420); // Returns 60🎯 VOLUME VI: COMPLETE GSAP PARITY SUITE
20. Zero-Allocation 120 FPS Cursor Trackers (quickTo, quickSetter)
Optimized for high-frequency events (e.g. mousemove, touchmove, deviceorientation). Reuses an internal pre-allocated tween:
import { animate } from 'pushmagic';
const xTo = animate.quickTo('#follower', 'x', { duration: 0.2, ease: 'easeOutQuad' });
const yTo = animate.quickTo('#follower', 'y', { duration: 0.2, ease: 'easeOutQuad' });
window.addEventListener('pointermove', (e) => {
xTo(e.clientX);
yTo(e.clientY);
});21. Responsive Viewport Manager (matchMedia()) with Auto-Revert
Declare animations for specific media queries. When the viewport resizes outside the media query, active animations and inline styles revert automatically:
import { matchMedia, animate } from 'pushmagic';
const mm = matchMedia();
mm.add('(min-width: 1024px)', () => {
// Desktop layout animation
animate('.sidebar').moveRight(320).play();
return () => {
// Optional custom cleanup hook
console.log('Viewport resized below 1024px');
};
});
mm.add('(max-width: 1023px)', () => {
// Mobile drawer animation
animate('.drawer').moveDown(150).play();
});22. ScrollSmoother Momentum Smooth Scrolling & Parallax Layers
Creates buttery-smooth momentum scrolling and parses declarative data-speed and data-lag attributes:
import { ScrollSmoother } from 'pushmagic';
ScrollSmoother.create({
smooth: 1.2, // Deceleration lag in seconds
effects: true // Enable data-speed and data-lag DOM attributes
});<div id="smooth-wrapper">
<div id="smooth-content">
<div data-speed="0.5">Moves at 50% scroll speed (Background depth)</div>
<div data-speed="1.4">Moves at 140% scroll speed (Foreground pop)</div>
<div data-lag="0.2">Follows with 200ms momentum lag</div>
</div>
</div>23. SVGMorph (Bezier Point Subdivision Equalizer) & DrawSVG
SVGMorph
Automatically subdivides path Bezier vertices to match topology counts, enabling smooth morphing between complex SVG paths:
animate('#iconPath')
.morphTo('#starPath')
.for(1.2)
.ease('easeInOutCubic')
.play();DrawSVG
Animates stroke line segment windows via percentage strings:
// Draw from 0% to 100% stroke
animate('#vectorLine').draw('0% 100%').for(1.5).play();
// Reveal middle 30% window
animate('#vectorLine').draw('35% 65%').for(1.0).play();⚛️ VOLUME VII: DECLARATIVE FRAMEWORK ECOSYSTEMS
24. React 19 Framer Motion Parity (pushmagic/react)
pushmagic/react provides 100% API parity with Framer Motion, while running on pushmagic's high-speed WAAPI/RAF hybrid engine.
24.1 Proxy Elements: <magic.div>, <magic.button>, etc.
All HTML and SVG elements are available as <magic.*> primitives:
import { magic } from 'pushmagic/react';
export function Card() {
return (
<magic.div
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1.0 }}
transition={{ duration: 0.5, ease: 'easeOutBack' }}
>
<h3>Declarative React Card</h3>
</magic.div>
);
}24.2 Gestures: whileHover, whileTap, whileInView, whileDrag
<magic.button
whileHover={{ scale: 1.05, y: -2 }}
whileTap={{ scale: 0.95 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true, margin: '-50px' }}
transition={{ spring: { stiffness: 400, damping: 20 } }}
>
Interactive Button
</magic.button>24.3 Shared Layout FLIP Morphing (layoutId)
Seamlessly morph elements between different React component subtrees using FLIP (First, Last, Invert, Play) geometry:
import { useState } from 'react';
import { magic } from 'pushmagic/react';
export function TabBar() {
const [selected, setSelected] = useState('home');
const tabs = ['home', 'features', 'pricing'];
return (
<div style={{ display: 'flex', gap: '8px' }}>
{tabs.map((tab) => (
<button key={tab} onClick={() => setSelected(tab)} style={{ position: 'relative' }}>
{selected === tab && (
<magic.div
layoutId="activeTabIndicator"
transition={{ spring: { stiffness: 350, damping: 25 } }}
style={{ position: 'absolute', inset: 0, background: '#6366f1', borderRadius: '8px', zIndex: -1 }}
/>
)}
{tab}
</button>
))}
</div>
);
}24.4 Unmount Exit Orchestration (<AnimatePresence>)
Keeps exiting elements in the React DOM until exit keyframe transitions complete:
import { useState } from 'react';
import { magic, AnimatePresence } from 'pushmagic/react';
export function Modal() {
const [isOpen, setIsOpen] = useState(false);
return (
<div>
<button onClick={() => setIsOpen(!isOpen)}>Toggle</button>
<AnimatePresence>
{isOpen && (
<magic.div
initial={{ opacity: 0, scale: 0.8 }}
animate={{ opacity: 1, scale: 1.0 }}
exit={{ opacity: 0, scale: 0.8 }}
transition={{ duration: 0.3 }}
>
<h2>Modal Window</h2>
</magic.div>
)}
</AnimatePresence>
</div>
);
}24.5 Hooks: useScroll, useInView, useMotionValue, useTransform, useScrollTimeline
import { useRef } from 'react';
import { useScroll, useInView, useMotionValue, useTransform } from 'pushmagic/react';
export function ParallaxHero() {
const targetRef = useRef(null);
// 1. Viewport InView Hook
const isInView = useInView(targetRef, { once: true });
// 2. Scroll Progress Hook
const { scrollYProgress } = useScroll({ target: targetRef });
// 3. Motion Values & Interpolation
const y = useMotionValue(0);
const opacity = useTransform(scrollYProgress, [0, 1], [1, 0]);
return (
<div ref={targetRef} style={{ opacity }}>
<h1>{isInView ? 'In View!' : 'Scrolling...'}</h1>
</div>
);
}25. Vue 3 Template Directives & Composables (pushmagic/vue)
<script setup>
import { vMagic } from 'pushmagic/vue';
</script>
<template>
<div
v-magic="{
initial: { opacity: 0, y: 50 },
inView: { opacity: 1, y: 0 },
hover: { scale: 1.05, y: -4 },
tap: { scale: 0.95 },
duration: 0.6,
ease: 'easeOutBack'
}"
class="card"
>
<h2>Vue 3 Directives</h2>
</div>
</template>26. Svelte 4/5 Action Directives (pushmagic/svelte)
<script>
import { svelteMagic } from 'pushmagic/svelte';
</script>
<div
use:svelteMagic={{
initial: { opacity: 0, scale: 0.8 },
whileInView: { opacity: 1, scale: 1.0 },
whileHover: { scale: 1.05 },
whileTap: { scale: 0.95 },
duration: 0.5
}}
class="card"
>
<h2>Svelte Action</h2>
</div>🤖 VOLUME VIII: AI NATURAL MOTION, DEVTOOLS & CSS HOUDINI
27. AI Natural Language Motion Engine (magic.prompt())
Translate human conversational instructions directly into mathematical spring parameters and keyframe transformations with 0ms latency and no API key required:
import { animate } from 'pushmagic';
// Natural Prompt Chaining
animate('#heroButton').prompt("Apple-style subtle hover lift with a snappy jelly bounce on click");
// Static Prompt Shortcut
animate.prompt('#modalCard', "Smooth fade up from bottom with dramatic slow deceleration");NLP Parser Keyword Dictionary:
- Style & Dynamics:
apple,subtle,snappy,dramatic,heavy,bouncy,liquid,cyberpunk,elastic,smooth,clean,gentle. - Actions & Coordinates:
fade up,fade down,slide in left,slide in right,zoom in,zoom out,pop in,lift,hover,spin,rotate,glitch,jelly,wobble,pulse. - Timings:
fast,quick,smooth,slow,epic,cinematic.
28. In-Browser Visual Studio Scrubber GUI (Shift + P, studio())
Press Shift + P anywhere on your page, or call studio() in your code to launch the built-in floating glassmorphism Studio GUI:
import { studio } from 'pushmagic';
// Launch Studio Programmatically
studio();Studio Features:
- Frame-by-Frame Scrubber: Scrub back and forth across active animations.
- Live Spring Physics Sandbox: Sliders for Stiffness ($20–500$), Damping ($2–60$), and Mass ($0.1–5.0$).
- Global Speed Multipliers: Run sequences in slow-motion ($0.25x$, $0.5x$, $1.0x$, $2.0x$).
- 1-Click TS/JS Code Generator: Copies tuned parameters directly to your clipboard.
- FPS & Memory Telemetry: Real-time monitor of frame rates and GC allocation rates.
29. Native CSS Houdini Zero-JS ScrollTimeline Engine
Binds scroll and viewport visibility animations directly to ScrollTimeline and ViewTimeline on the browser compositor thread. Zero JavaScript runs per scroll frame, keeping animations locked at 120 FPS:
import { animate } from 'pushmagic';
import { useScrollTimeline } from 'pushmagic/react';
// Vanilla JS Compositor Scroll
animate('#card').scrollProgress(
[
{ transform: 'scale(0.8) translateY(100px)', opacity: 0.3 },
{ transform: 'scale(1.0) translateY(0px)', opacity: 1.0 }
],
{ source: document.querySelector('#scroll-container') }
);
// React Hook
function HeroBanner() {
const ref = useRef(null);
useScrollTimeline(ref, [
{ transform: 'translateY(-50px)' },
{ transform: 'translateY(50px)' }
]);
return <div ref={ref}>Compositor Parallax</div>;
}🎨 VOLUME IX: UI COMPONENTS & HIGH-PERFORMANCE GRAPHICS
30. "Shadcn for Motion" UI Components Registry (pushmagic/ui)
Pre-built, copy-paste interactive UI components with zero external CSS dependencies:
import {
MacDock,
VisionCard,
LiquidTabs,
SpotlightCard,
CyberpunkText,
AuroraBackground
} from 'pushmagic/ui';30.1 MacDock (macOS Magnification Dock)
Features Gaussian bell-curve magnification on pointer hover:
<MacDock
items={[
{ id: '1', icon: '🚀', label: 'Launch' },
{ id: '2', icon: '🎨', label: 'Canvas' },
{ id: '3', icon: '⚡', label: 'Compute' },
{ id: '4', icon: '🔮', label: 'AI' }
]}
baseSize={44}
magnification={72}
distance={140}
/>30.2 VisionCard (Apple VisionOS 3D Spatial Tilt & Specular Glare)
Calculates real-time 3D gyroscope tilt and dynamic specular glare reflection:
<VisionCard maxTilt={15} glareOpacity={0.25}>
<div style={{ padding: '32px' }}>
<h3>VisionOS Spatial Card</h3>
<p>Dynamic specular glare and 3D depth</p>
</div>
</VisionCard>30.3 LiquidTabs (Fluid Jelly Tab Indicator)
Features fluid jelly-spring morphing using shared layout geometry:
<LiquidTabs
tabs={[
{ id: 'overview', label: 'Overview' },
{ id: 'analytics', label: 'Analytics' },
{ id: 'settings', label: 'Settings' }
]}
activeTab={activeTab}
onChange={setActiveTab}
/>30.4 SpotlightCard (Bento Radial Glow Flashlight)
Tracks cursor coordinates to render a radial flashlight gradient:
<SpotlightCard spotlightColor="rgba(99, 102, 241, 0.25)" spotlightRadius={300}>
<div style={{ padding: '24px' }}>
<h3>Bento Metric Card</h3>
<p>Interactive radial glow on hover</p>
</div>
</SpotlightCard>30.5 CyberpunkText (Matrix ASCII Decoder)
Animates text decryption with randomized matrix character cycling:
<CyberpunkText
text="SYSTEM_SECURITY_ONLINE"
duration={1.2}
characters="ABCDEF0123456789!@#$%^&*"
/>30.6 AuroraBackground (Organic Ambient Gradient Mesh)
Renders smooth, organic multi-layered ambient radial glows:
<AuroraBackground>
<div style={{ textAlign: 'center', padding: '80px 20px' }}>
<h1 style={{ fontSize: '3rem', color: '#fff' }}>Unmatched Motion</h1>
</div>
</AuroraBackground>31. WebGPU 120 FPS Compute Particle Physics Engine (pushmagic/webgpu)
Simulates 500,000+ interactive particles directly on GPU compute shaders via WebGPU:
import { ParticleCanvas, WebGPUEngine } from 'pushmagic/webgpu';
export function ParticleHero() {
return (
<ParticleCanvas
width={1000}
height={600}
particleCount={150000}
mode="vortex" // 'vortex' | 'gravity' | 'repel' | 'drift'
speed={1.2}
pointSize={1.5}
/>
);
}32. 3D WebGL / Three.js & 2D-to-3D Morph Bridge (morphTo3D)
Three.js Object Animation
import { animate } from 'pushmagic';
import * as THREE from 'three';
const mesh = new THREE.Mesh(new THREE.BoxGeometry(2, 2, 2), new THREE.MeshStandardMaterial());
// Animate Three.js Mesh
animate(mesh)
.move({ x: 5, y: 2, z: -10 })
.rotateY(180)
.for(1.5)
.ease('easeOutBack')
.play();2D-to-3D Morph Bridge (morphTo3D)
Seamlessly projects a 2D DOM element's screen coordinates into 3D camera space:
import { animate } from 'pushmagic';
animate.morphTo3D(domCardElement, threeMesh, camera, {
duration: 1.0,
ease: 'easeOutBack',
onComplete: () => console.log('Morphed to 3D!')
});📖 VOLUME X: ENTERPRISE RECIPES, MIGRATIONS & TYPE SYSTEM
33. Migration Guide: From GSAP to pushmagic
| GSAP Syntax | pushmagic Equivalent |
| :--- | :--- |
| gsap.to(el, { x: 100, duration: 1 }) | animate(el).to({ x: 100 }).for(1).play() |
| gsap.from(el, { opacity: 0 }) | animate(el).from({ opacity: 0 }).play() |
| gsap.fromTo(el, { y: 50 }, { y: 0 }) | animate(el).fromTo({ y: 50 }, { y: 0 }).play() |
| gsap.timeline() | timeline() |
| tl.to(el, { x: 100 }, "<") | tl.to(el, { x: 100 }, "<") |
| gsap.quickTo(el, "x") | animate.quickTo(el, "x") |
| gsap.quickSetter(el, "opacity") | animate.quickSetter(el, "opacity") |
| gsap.matchMedia() | matchMedia() |
| gsap.utils.clamp(min, max, v) | utils.clamp(min, max, v) |
| gsap.utils.mapRange(a, b, c, d, v) | utils.mapRange(a, b, c, d, v) |
| CustomEase.create(name, path) | CustomEase.create(name, path) |
| ScrollSmoother.create({...}) | ScrollSmoother.create({...}) |
34. Migration Guide: From Framer Motion to pushmagic
| Framer Motion Syntax | pushmagic/react Equivalent |
| :--- | :--- |
| <motion.div animate={{ opacity: 1 }} /> | <magic.div animate={{ opacity: 1 }} /> |
| <motion.button whileHover={{ scale: 1.1 }} />| <magic.button whileHover={{ scale: 1.1 }} />|
| <motion.div layoutId="tab" /> | <magic.div layoutId="tab" /> |
| <AnimatePresence> | <AnimatePresence> |
| useScroll() | useScroll() |
| useInView(ref) | useInView(ref) |
| useMotionValue(0) | useMotionValue(0) |
| useTransform(x, [0, 100], [0, 1]) | useTransform(x, [0, 100], [0, 1]) |
35. Production Performance & 120 FPS Optimization Checklist
- Prefer Transform Channels: Always animate
x,y,z,scale,rotation, andopacityto keep execution on the GPU compositor thread. - Use
.quickTo()for High-Frequency Events: For pointer followers and gyroscope listeners, useanimate.quickTo()to bypass object instantiation. - Use Sub-Packages: Import from
pushmagic/liteorpushmagic/reactto optimize production bundle sizes. - Clean Up Custom Hooks:
matchMedia()instances automatically clean up when.revert()is invoked.
36. Complete TypeScript Type Definitions Reference
export interface TargetStyles {
x?: number;
y?: number;
z?: number;
rotation?: number;
rotationX?: number;
rotationY?: number;
rotationZ?: number;
scale?: number;
scaleX?: number;
scaleY?: number;
scaleZ?: number;
opacity?: number;
color?: string | number;
backgroundColor?: string;
borderColor?: string;
blur?: number;
[customProp: string]: any;
}
export interface SpringConfig {
stiffness?: number; // Default: 170
damping?: number; // Default: 26
mass?: number; // Default: 1.0
velocity?: number; // Default: 0.0
}
export interface TimelineOptions {
onStart?: () => void;
onUpdate?: (progress: number) => void;
onComplete?: () => void;
repeat?: number;
yoyo?: boolean;
}
export interface MagicProps<T extends HTMLElement = HTMLElement> extends React.HTMLAttributes<T> {
children?: React.ReactNode;
layoutId?: string;
initial?: TargetStyles | boolean;
animate?: TargetStyles;
exit?: TargetStyles;
whileHover?: TargetStyles;
whileTap?: TargetStyles;
whileInView?: TargetStyles;
viewport?: { once?: boolean; margin?: string; amount?: number };
transition?: {
duration?: number;
delay?: number;
ease?: string;
spring?: boolean | SpringConfig;
};
onAnimationComplete?: () => void;
}📄 License
MIT © 2026 pushmagic contributors. Designed for high-performance creative engineering.
