animate
animate starts an animation without rendering a motion.* component. Pass an element, selector,
or MotionValue, then provide the target keyframes and optional transition. It returns
AnimationPlaybackControls, which can be paused, cancelled, completed, or awaited.
import { animate } from 'motion-solidjs'
const controls = animate(
'.card',
{ y: -20, opacity: 1 },
{
type: 'spring',
stiffness: 320,
damping: 18,
},
)
await controls
controls.cancel()
Signatures
animate(element | selector | motionValue, keyframes, transition?)
animate(from, to, options) // tween between two raw values
animate(generator) // run a custom generator
See also
createAnimate- scoped, ref-based versionspring- pure spring generator