Search

Back

Copy Link

Library

/

Free

/

25

Moving Border

25

Moving Border

Not loading? Preview

Made by

Temani Afif

override

hover

Override

Moving Border

Copy

Override

Copied to Clipboard!

Instructions

  1. Apply to a frame around the frame you want to highlight

  2. Go to the override and click "edit code"

  3. In line 22 of the code you can change the HEX value of the color

  4. Lines 19,20 of the code control the width of the border

Code Preview

import type { ComponentType } from "react"
import { motion } from "framer-motion"

export function withMovingLinesHover(Component): ComponentType {
    return (props) => {
        const hoverVariants = {
            initial: { "--_p": "25%" },
            hover: { "--_p": "75%" },
        }

        return (
            <Component
                {...props}
                as={motion.div}
                initial="initial"
                whileHover="hover"
                style={{
                    ...props.style,
                    // Change width of stroke
                    "--g": "2px",
                    "--b": "2px",
                    //Change the color here//
                    "--c": "#97E025",
                    padding: "calc(var(--g) + var(--b))",
                    "--_c": "#0000 0 25%, var(--c) 0 50%",
                    "--_g1":
                        "repeating-linear-gradient(90deg ,var(--_c)) repeat-x",
                    "--_g2":
                        "repeating-linear-gradient(180deg,var(--_c)) repeat-y",
                    background:
                        "var(--_g1) var(--_p, 25%) 0   ,var(--_g2) 0    var(--_p,125%)," +
                        "var(--_g1) var(--_p,125%) 100%,var(--_g2) 100% var(--_p, 25%)",
                    backgroundSize: "200% var(--b),var(--b) 200%",
                    transition: "0.15s ease-out", // Updated transition property
                }}
                variants={hoverVariants}
            >
                {props.children}
            </Component>
        )
    }
}

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.