Search

Back

Copy Link

Library

/

Free

/

10

Blob Distort

10

Blob Distort

Not loading? Preview

Made by

@frameroverrides

override

hover

Override

Blob Distort

Copy

Override

Copied to Clipboard!

Instructions

Apply to a frame that has a radius

Code Preview

import { Override, useAnimation } from "framer"
import { useEffect, useState } from "react"

function getRandomPercentage() {
    return Math.floor(Math.random() * 100) + 30
}

function createRandomBorderRadius() {
    return `${getRandomPercentage()}% ${getRandomPercentage()}% ${getRandomPercentage()}% ${getRandomPercentage()}% / ${getRandomPercentage()}% ${getRandomPercentage()}% ${getRandomPercentage()}% ${getRandomPercentage()}%`
}

export function RandomBlobEffect(): Override {
    const animation = useAnimation()
    const [intervalId, setIntervalId] = useState(null)

    const startAnimation = () => {
        const animateBlob = () => {
            animation.start({
                borderRadius: createRandomBorderRadius(),
                transition: { duration: 2.5 },
            })
        }

        const interval = setInterval(animateBlob, 1100)
        setIntervalId(interval)
        animateBlob()
    }

    const stopAnimation = () => {
        clearInterval(intervalId)
    }

    useEffect(() => {
        // Initial animation for a smooth start
        animation.start({
            borderRadius: createRandomBorderRadius(),
            transition: { duration: 1.5 },
        })

        return () => clearInterval(intervalId)
    }, [animation, intervalId])

    return {
        animate: animation,
        onMouseEnter: startAnimation,
        onMouseLeave: stopAnimation,
    }
}

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.