A tiny, performant animation library for SolidJS with advanced features including drag, layout animations, scroll integration, advanced gestures, orchestration, and cutting-edge graphics capabilities.
- Tiny & Performant: Only 54kb gzipped (core), 189kb with all features
- TypeScript: Full type safety with comprehensive interfaces
- SolidJS Native: Built specifically for SolidJS reactivity patterns
- Motion One Powered: Leverages the full power of Motion One under the hood
- Drag Constraints: Limit drag boundaries with elastic behavior
- Drag Momentum: Physics-based momentum with decay
- Multi-Axis Support: X, Y, or both axis dragging
- Event Handling: Complete drag lifecycle events
- FLIP Technique: Smooth layout transitions using FLIP animation
- Shared Elements: Seamless element transitions between components
- LayoutGroup: Coordinate layout animations across components
- Automatic Detection: Layout change detection with MutationObserver
- Scroll Tracking: Real-time scroll position monitoring
- Parallax Effects: Smooth parallax animations
- Viewport Detection: Enter/leave animations based on viewport
- Scroll-Based Triggers: Animation triggers on scroll events
- Multi-Touch: Multi-finger gesture recognition
- Pinch-to-Zoom: Scale and rotation gestures
- Gesture Constraints: Min/max scale and rotation limits
- Momentum: Gesture momentum with natural decay
- Stagger Animations: Sequential element animations
- Timeline Sequencing: Complex animation sequences
- Performance Optimized: RAF batching and memory management
- Combined Controls: Stagger and timeline orchestration
- Animation Debugger: Visual debugging tools for animations
- Accessibility: ARIA support and reduced motion preferences
- Presets: Pre-built animation presets for common use cases
- Sequences: Complex animation sequences with precise timing
- Canvas Integration: HTML5 Canvas 2D and WebGL context support
- WebGL Support: WebGL 1.0 and 2.0 rendering with shader compilation
- Particle System: Dynamic particle creation with physics simulation
- 3D Animation: 3D transformation management with matrix operations
npm install solid-motionone
# or
pnpm add solid-motionone
# or
yarn add solid-motiononeimport { Motion } from "solid-motionone"
function App() {
return (
<Motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
drag
layout
scroll
pinchZoom
stagger={0.1}
>
Animated Element
</Motion.div>
)
}<Motion.div
initial={{ opacity: 0, scale: 0.8 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ duration: 0.5 }}
>
Fade In
</Motion.div><Motion.div
drag
dragConstraints={{ left: -100, right: 100 }}
dragMomentum
whileDrag={{ scale: 1.1 }}
onDragStart={(event, info) => console.log("Drag started")}
onDrag={(event, info) => console.log("Dragging")}
onDragEnd={(event, info) => console.log("Drag ended")}
>
Draggable Element
</Motion.div>import { LayoutGroup } from "solid-motionone"
<LayoutGroup>
<Motion.div
layout
layoutId="shared-element"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
>
Shared Layout Element
</Motion.div>
</LayoutGroup><Motion.div
scroll
parallax={0.5}
onViewEnter={() => console.log("Entered viewport")}
onViewLeave={() => console.log("Left viewport")}
>
Scroll Element
</Motion.div><Motion.div
pinchZoom
minScale={0.5}
maxScale={3.0}
momentum
whilePinch={{ scale: 1.05, opacity: 0.8 }}
onPinchStart={(event, state) => console.log("Pinch started")}
onPinchMove={(event, state) => console.log("Pinching")}
onPinchEnd={(event, state) => console.log("Pinch ended")}
>
Pinch Zoom Element
</Motion.div><Motion.div
stagger={0.1}
staggerDirection="from-center"
timeline={{
duration: 2000,
segments: [
{ at: 0, animation: { opacity: 0 } },
{ at: 500, animation: { opacity: 1 } },
{ at: 1500, animation: { opacity: 0.8 } }
],
repeat: "loop"
}}
orchestrate
onStaggerStart={(state) => console.log("Stagger started")}
onTimelineUpdate={(progress) => console.log("Timeline:", progress)}
>
Orchestrated Element
</Motion.div><Motion.div
canvas
canvasWidth={300}
canvasHeight={200}
canvasContext="2d"
onCanvasReady={(canvas, context) => {
console.log('Canvas ready:', canvas);
}}
onCanvasRender={(context, deltaTime) => {
// Custom canvas rendering
context.fillStyle = 'red';
context.fillRect(0, 0, 100, 100);
}}
>
Canvas Element
</Motion.div><Motion.div
webgl
webglVersion="2.0"
webglVertexShader={`
attribute vec2 position;
void main() {
gl_Position = vec4(position, 0.0, 1.0);
}
`}
webglFragmentShader={`
precision mediump float;
void main() {
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
`}
onWebGLReady={(gl, program) => {
console.log('WebGL ready:', gl, program);
}}
>
WebGL Element
</Motion.div><Motion.div
particles
particleCount={100}
particleSize={{ min: 2, max: 8 }}
particleColor={['#ff6b6b', '#4ecdc4', '#45b7d1']}
particleEmission="continuous"
particleVelocity={{ x: 0, y: -2, z: 0 }}
particleGravity={{ x: 0, y: 0.1, z: 0 }}
onParticleCreate={(particle) => {
console.log('Particle created:', particle);
}}
onParticleUpdate={(particle, deltaTime) => {
// Custom particle update logic
}}
>
Particle System Element
</Motion.div><Motion.div
threeD
threeDPerspective={1000}
threeDRotateX={45}
threeDRotateY={30}
threeDTranslateZ={100}
threeDScaleX={1.2}
threeDScaleY={0.8}
onThreeDUpdate={(matrix) => {
console.log('3D matrix updated:', matrix);
}}
>
3D Animated Element
</Motion.div><Motion.div
// Core animations
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
// Drag system
drag
dragConstraints={{ left: -50, right: 50 }}
// Layout animations
layout
layoutId="complex-element"
// Scroll integration
scroll
parallax={0.3}
// Advanced gestures
pinchZoom
minScale={0.8}
maxScale={2.0}
// Orchestration
stagger={0.2}
orchestrate
// Advanced graphics
canvas
particles
threeD
>
Complex Animated Element
</Motion.div>initial- Initial animation stateanimate- Target animation stateexit- Exit animation statetransition- Animation configurationvariants- Reusable animation states
drag- Enable drag (boolean | "x" | "y")dragConstraints- Drag boundariesdragElastic- Elastic drag behaviordragMomentum- Enable momentumwhileDrag- Animation during dragonDragStart- Drag start callbackonDrag- Drag move callbackonDragEnd- Drag end callback
layout- Enable layout animationslayoutId- Shared element identifierlayoutRoot- Layout root elementlayoutScroll- Include scroll in layout
scroll- Enable scroll trackingscrollContainer- Scroll container elementparallax- Parallax effect strengthonViewEnter- Enter viewport callbackonViewLeave- Leave viewport callback
multiTouch- Enable multi-touchpinchZoom- Enable pinch-to-zoomminScale- Minimum scalemaxScale- Maximum scalemomentum- Enable gesture momentumwhilePinch- Animation during pinchonPinchStart- Pinch start callbackonPinchMove- Pinch move callbackonPinchEnd- Pinch end callback
stagger- Stagger delay (number | config)staggerDirection- Stagger directiontimeline- Timeline configurationorchestrate- Enable orchestrationonStaggerStart- Stagger start callbackonStaggerComplete- Stagger complete callbackonTimelineStart- Timeline start callbackonTimelineUpdate- Timeline update callbackonTimelineComplete- Timeline complete callback
canvas- Enable canvas integrationcanvasWidth- Canvas widthcanvasHeight- Canvas heightcanvasContext- Canvas context type ("2d" | "webgl" | "webgl2")onCanvasReady- Canvas ready callbackonCanvasResize- Canvas resize callbackonCanvasRender- Canvas render callback
webgl- Enable WebGL supportwebglVersion- WebGL version ("1.0" | "2.0")webglVertexShader- Vertex shader sourcewebglFragmentShader- Fragment shader sourcewebglAttributes- WebGL attributes configurationwebglUniforms- WebGL uniforms configurationonWebGLReady- WebGL ready callbackonWebGLRender- WebGL render callback
particles- Enable particle systemparticleCount- Number of particlesparticleSize- Particle size (number | { min, max })particleColor- Particle color (string | string[] | object)particleEmission- Emission type ("continuous" | "burst" | "explosion")particleVelocity- Particle velocity configurationparticleGravity- Particle gravity configurationonParticleCreate- Particle creation callbackonParticleUpdate- Particle update callbackonParticleDestroy- Particle destruction callback
threeD- Enable 3D animationthreeDPerspective- 3D perspective valuethreeDRotateX- X-axis rotationthreeDRotateY- Y-axis rotationthreeDRotateZ- Z-axis rotationthreeDTranslateX- X-axis translationthreeDTranslateY- Y-axis translationthreeDTranslateZ- Z-axis translationthreeDScaleX- X-axis scalethreeDScaleY- Y-axis scalethreeDScaleZ- Z-axis scaleonThreeDUpdate- 3D matrix update callback
# Run all tests
npm test
# Run tests in watch mode
npm run test:ui
# Run tests with coverage
npm run test:coverage- Core Bundle: 54kb gzipped (basic features)
- Full Bundle: 189kb gzipped (all features included)
- Runtime Performance: Optimized with RAF batching
- Memory Usage: Efficient memory management with automatic cleanup
- TypeScript: Full type safety with comprehensive interfaces
- Build Time: ~1.4 seconds
Check out our comprehensive demo showcasing all Phase 10 features:
- Canvas 2D Animation: Interactive canvas animations
- WebGL Rendering: WebGL 1.0 and 2.0 demonstrations
- Particle System: Dynamic particle effects with controls
- 3D Animation: 3D transformation examples
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE for details.
Built on top of @motionone/dom with SolidJS integration.
solid-motionone - Powerful animations for SolidJS applications! π
Now with advanced graphics capabilities including Canvas, WebGL, particle systems, and 3D animations!