Search

Back

Copy Link

Library

/

Free

/

79

Bounce

79

Bounce

Not loading? Preview

Made by

@frameroverrides

override

none

Override

Bounce

Copy

Override

Copied to Clipboard!

Instructions

Code Preview

import { motion, useAnimation } from "framer-motion"
import React, { useEffect } from "react"
import type { ComponentType } from "react"

export function withBounce(Component): ComponentType {
    return (props) => {
        const controls = useAnimation()

        const maxHeight = -122 // max jump height

        useEffect(() => {
            controls.start({
                y: [
                    0,
                    maxHeight,
                    0,
                    maxHeight * 0.38,
                    0,
                    maxHeight * 0.13,
                    0,
                    maxHeight * 0.04,
                    0,
                ],
                transition: {
                    duration: 1.5,
                    times: [0, 0.3, 0.47, 0.6, 0.73, 0.82, 0.89, 0.94, 1],
                    ease: "easeIn",
                    repeat: Infinity,
                    repeatDelay: 2,
                },
            })
        }, [controls])

        return <Component {...props} as={motion.div} animate={controls} />
    }
}

Terms of Use for Free Assets

By accessing and using this Framer Override Library, you agree to the following terms:

All code snippets provided are available for your personal and professional use. This includes personal websites, client projects, and other website projects in Framer. You are strictly prohibited from sharing, redistributing, selling these code snippets, or creating derivative works for resale or distribution. Unauthorized sharing, distribution, or selling of these code snippets is a breach of these terms and may result in termination of your access to this library, along with potential legal action.