How to use the @popmotion/popcorn.wrap function in @popmotion/popcorn

To help you get started, we’ve selected a few @popmotion/popcorn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github framer / motion / src / utils / use-cycle.ts View on Github external
(next?: number) => {
            index.current =
                typeof next !== "number"
                    ? wrap(0, items.length, index.current + 1)
                    : next

            setItem(items[index.current])
        },
    ]
github framer / motion / dev / examples / animateImageGallery.tsx View on Github external
export const App = () => {
    const [[page, delta], setPage] = useState([0, 0])
    const imageIndex = wrap(0, images.length, page)

    const paginate = (newDelta: number) => {
        setPage([page + newDelta, newDelta])
    }

    return (
        <div>
            
                <img src="{images[imageIndex]}">
            
             paginate(1)}&gt;</div>