packages/component/skills/animate-elements/SKILL.md
remix/component)Use this skill when building animations.
Import mixin helpers from remix/component and apply them via mix.
import { animateEntrance, animateExit, animateLayout, spring } from 'remix/component'
let el = (
<div
key="card"
mix={[
animateEntrance({ opacity: 0, transform: 'scale(0.95)', ...spring('snappy') }),
animateExit({ opacity: 0, transform: 'scale(0.98)', duration: 120, easing: 'ease-in' }),
animateLayout({ duration: 220, easing: 'ease-out' }),
]}
/>
)
<div
mix={[
animateEntrance({
opacity: 0,
transform: 'translateY(8px)',
duration: 180,
easing: 'ease-out',
}),
]}
/>
{
isVisible && (
<div
key="panel"
mix={[
animateEntrance({ opacity: 0, transform: 'scale(0.98)', duration: 180 }),
animateExit({ opacity: 0, transform: 'scale(0.98)', duration: 120, easing: 'ease-in' }),
]}
/>
)
}
{
items.map((item) => (
<li
key={item.id}
mix={[
animateLayout({
...spring({ duration: 500, bounce: 0.2 }),
}),
]}
/>
))
}
<div css={{ display: 'grid', '& > *': { gridArea: '1 / 1' } }}>
{state ? (
<div key="a" mix={[animateEntrance({ opacity: 0 }), animateExit({ opacity: 0 })]} />
) : (
<div key="b" mix={[animateEntrance({ opacity: 0 }), animateExit({ opacity: 0 })]} />
)}
</div>
animateLayout on the element whose position/size changes.spring(...) into the mixin config....spring() for duration/easing in most cases.handle.queueTask(...) or ref(...), not in pure render math.animateLayout is only on moving/resizing nodes.