On this page

Compare with motion/react

Each example below runs twice, with the same props and the same controls: solid-motion on the left and motion/react on the right. Change a control and both start over. The manual pages do the same for one feature at a time.

Shared layout

A card and its open view share a layoutId. The open view grows out of the card, and closing it shrinks it back into its slot. The backdrop enters and leaves through AnimatePresence.

Exit and layout together

Dismissing the front card plays its exit while the cards behind it animate to their new depth. The depth comes from each card's index, so a change to the list changes every card's target.

Reorder

Drag a row. Reorder.Group calls onReorder with the new order, and the other rows slide into the gap.

Many elements

This mounts the same number of looping elements in each library, one library at a time. It records how long the mount took and how evenly frames arrived over the next two seconds, then removes the elements. The motion/react code is loaded before the first run, so the download is not counted.

Mount time is the synchronous render: building the components and inserting the elements. Frame times depend on the device and on what else the page is doing, so run it a few times. A frame near 16.7 ms is a 60 Hz display keeping up.

Unmount is the time to remove the elements. solid-motion also stops their animations, so it takes longer than motion/react.

Architecture lists the animations that keep running smoothly while the page is busy.

What differs in the code

The components and props are the same. The differences follow from Solid:

motion/reactsolid-motion
classNameclass
useMotionValue, useTransformcreateMotionValue, createTransform
useScroll, useInViewcreateScroll, createInView
useAnimate, useDragControlscreateAnimate, createDragControls
<AnimatePresence>{open && …}<AnimatePresence when={open()}>{() => …}
<AnimatePresence> around a .map<AnimatePresenceList each={…} getKey={…}>
key on each child<For>, or getKey on AnimatePresenceList

Presence explains when and AnimatePresenceList.