Create an animation with the Motion component
mainThe Motion component is the primary way to create animatable elements. You can use it as a wrapper for content, or use specific element types like <Motion.div>, <Motion.button>, or the generic <Motion tag="button"> to render specific HTML or SVG elements.
import {Motion} from "solid-motionone"
// As a wrapper
function MyComponent() {
return <Motion>Hello world</Motion>
}
// As a specific HTML element
function App() {
return (
<Motion.div
animate={{opacity: [0, 1]}}
transition={{duration: 1, easing: "ease-in-out"}}
/>
)
}
// Using the tag prop
<Motion tag="button" />