This directory contains curated examples demonstrating the capabilities of the Leptos Motion library.
We've curated 12 high-quality examples from the original 35+ examples, focusing on:
- ✅ Working examples that compile and run successfully
- 🎨 Diverse use cases covering different animation types
- 📚 Clear demonstrations of library features
- 🚀 Real-world applications and practical examples
These are the essential examples that demonstrate the core functionality:
- Purpose: Full motion library showcase
- Features: Complete demonstration of all motion capabilities
- Uses:
leptos_motion::*- tests the full library - Status: ✅ Compiles, has built WASM
- Run:
cd comprehensive-showcase && trunk serve
- Purpose: Basic Leptos functionality (no motion)
- Features: Pure Leptos reactive system baseline
- Uses: Pure Leptos - good baseline for comparison
- Status: ✅ Compiles, has built WASM
- Run:
cd basic-leptos-demo && trunk serve
- Purpose: CSS-based animations (working approach)
- Features: CSS classes + Leptos signals for animations
- Uses: CSS transitions and transforms
- Status: ✅ Compiles, CSS-based approach
- Run:
cd phase2-minimal-demo && trunk serve
- Purpose: Simple motion library demo
- Features: Basic motion library usage
- Uses:
leptos_motion::* - Status: ✅ Compiles, has built WASM
- Run:
cd simple-animation-demo && trunk serve
- Purpose: Real-world e-commerce use case
- Features: Product gallery with motion effects
- Uses:
leptos_motion::* - Status: ✅ Compiles, has built WASM
- Run:
cd e-commerce-gallery && trunk serve
- Purpose: Scroll-based animations
- Features: Animations triggered by scroll position
- Uses:
leptos_motion::* - Status: ✅ Compiles, has built WASM
- Run:
cd scroll-progress-demo && trunk serve
- Purpose: UI component animations
- Features: Sidebar menu with motion effects
- Uses:
leptos_motion::* - Status: ✅ Compiles, has built WASM
- Run:
cd sidebar-menu-demo && trunk serve
- Purpose: Advanced path morphing animations
- Features: SVG path morphing and complex animations
- Uses:
leptos_motion::* - Status: ✅ Compiles, has built WASM
- Run:
cd path-morphing-demo && trunk serve
These examples demonstrate specific features and advanced capabilities:
- Purpose: Advanced gesture handling
- Features: Touch, drag, and gesture-based animations
- Uses:
leptos_motion::* - Status: ✅ Compiles successfully
- Run:
cd advanced-gestures && trunk serve
- Purpose: Layout-based animations
- Features: Animations triggered by layout changes
- Uses:
leptos_motion::* - Status: ✅ Compiles successfully
- Run:
cd layout-animations && trunk serve
- Purpose: Interactive game with animations
- Features: Puzzle game with motion effects
- Uses:
leptos_motion::* - Status: ✅ Compiles, has built WASM
- Run:
cd puzzle-game-demo && trunk serve
- Purpose: WASM performance testing
- Features: Performance benchmarks and optimization demos
- Uses:
leptos_motion::* - Status: ✅ Compiles successfully
- Run:
cd wasm-performance-demo && trunk serve
- Rust 1.70+
- Trunk (for building WASM)
- Modern web browser
-
Navigate to an example directory:
cd examples/comprehensive-showcase -
Install dependencies (if needed):
cargo check
-
Build and serve:
trunk serve
-
Open in browser: Navigate to
http://localhost:8080
trunk build --releaseAll examples have been tested and verified to:
- ✅ Compile successfully with the current library
- ✅ Use proper dependencies and workspace configuration
- ✅ Demonstrate real functionality (not just stubs)
- ✅ Follow best practices for Leptos and WASM
- Total Examples: 12 (curated from 35+)
- Working Examples: 12/12 (100%)
- Built WASM Examples: 8/12 (67%)
- Core Examples: 8
- Feature Examples: 4
We removed 23 examples that were:
- Development phases (10 phase1/phase2/phase3 examples)
- Non-workspace examples (5 examples not in Cargo.toml)
- Redundant examples (6 similar feature examples)
- Broken examples (2 incomplete examples)
We kept examples that:
- ✅ Compile successfully in the workspace
- ✅ Demonstrate unique features or use cases
- ✅ Have clear, working code (not stubs)
- ✅ Represent different animation types and approaches
- ✅ Include real-world applications and practical examples
- CSS-based animations (phase2-minimal-demo)
- Motion library animations (comprehensive-showcase)
- Scroll-triggered animations (scroll-progress-demo)
- Gesture-based animations (advanced-gestures)
- Layout animations (layout-animations)
- Path morphing (path-morphing-demo)
- UI component animations (sidebar-menu-demo)
- Game animations (puzzle-game-demo)
- Performance demos (wasm-performance-demo)
- Start with
basic-leptos-demo(pure Leptos) - Try
phase2-minimal-demo(CSS approach) - Move to
simple-animation-demo(motion library)
- Explore
comprehensive-showcase(full features) - Try
e-commerce-gallery(real-world use case) - Experiment with
scroll-progress-demo(scroll animations)
- Study
path-morphing-demo(advanced features) - Explore
advanced-gestures(gesture handling) - Benchmark with
wasm-performance-demo(performance)
When adding new examples:
- Ensure they compile in the workspace
- Add them to the workspace
Cargo.toml - Include clear documentation
- Test with
cargo check --workspace - Update this README
All examples are part of the Leptos Motion project and follow the same license terms.