Motion vibes, Svelte runes. This brings Motion’s declarative animation goodness to Svelte with motion.<tag>
components, interaction props, and composable config. If you spot a cool React example, drop it in an issue—we’ll port it. 😍
Requests welcome: Have a feature/prop/example you want? Please open an issue (ideally include a working Motion/React snippet or example link) and we’ll prioritize it.
All standard HTML elements are supported as motion components (e.g., motion.div
, motion.button
). See the full set in src/lib/html/
.
This package includes support for MotionConfig
, which allows you to set default motion settings for all child components. See the Reach - Motion Config for more details.
<MotionConfig transition={{ duration: 0.5 }}>
<!-- All motion components inside will inherit these settings -->
<motion.div animate={{ scale: 1.2 }}>Inherits 0.5s duration</motion.div>
</MotionConfig>
Svelte Motion supports minimal layout animations via FLIP using the layout
prop:
<motion.div layout transition={{ duration: 0.25 }} />
layout
: smoothly animates translation and scale between layout changes (size and position).layout="position"
: only animates translation (no scale).Some Motion features are not yet implemented:
reducedMotion
settingsfeatures
configurationtransformPagePoint
layoutId
(planned)This package carefully selects its dependencies to provide a robust and maintainable solution:
Motion | Demo / Route | REPL |
---|---|---|
React - Enter Animation | /tests/motion/enter-animation |
View Example |
HTML Content (0→100 counter) | /tests/motion/html-content |
View Example |
Aspect Ratio | /tests/motion/aspect-ratio |
View Example |
Random - Shiny Button by @verse_ | /tests/random/shiny-button |
View Example |
Fancy Like Button | /tests/random/fancy-like-button |
View Example |
MIT © Humanspeak, Inc.
Made with ❤️ by Humanspeak