This commit is contained in:
2026-01-19 19:16:42 +01:00
parent 5c9b2e3f5a
commit b99258f886
4 changed files with 70 additions and 7 deletions

View File

@@ -1,4 +1,7 @@
'use client';
import React from 'react';
import { motion, Variants } from 'framer-motion';
import { cn } from '@/components/ui';
interface ScribbleProps {
@@ -8,6 +11,18 @@ interface ScribbleProps {
}
export default function Scribble({ variant, className, color = '#82ed20' }: ScribbleProps) {
const pathVariants: Variants = {
hidden: { pathLength: 0, opacity: 0 },
visible: {
pathLength: 1,
opacity: 1,
transition: {
duration: 1.8,
ease: "easeInOut",
}
}
};
if (variant === 'circle') {
return (
<svg
@@ -16,12 +31,14 @@ export default function Scribble({ variant, className, color = '#82ed20' }: Scri
viewBox="0 0 800 350"
preserveAspectRatio="none"
>
<path
style={{ animationDuration: '1.8s' }}
<motion.path
variants={pathVariants}
initial="hidden"
whileInView="visible"
viewport={{ once: true }}
transform="matrix(0.9791300296783447,0,0,0.9791300296783447,400,179)"
strokeLinejoin="miter"
fillOpacity="0"
pathLength="1"
strokeMiterlimit="4"
stroke={color}
strokeOpacity="1"
@@ -40,11 +57,13 @@ export default function Scribble({ variant, className, color = '#82ed20' }: Scri
viewBox="-400 -55 730 60"
preserveAspectRatio="none"
>
<path
style={{ animationDuration: '1.8s' }}
<motion.path
variants={pathVariants}
initial="hidden"
whileInView="visible"
viewport={{ once: true }}
d="m -383.25 -6 c 55.25 -22 130.75 -33.5 293.25 -38 c 54.5 -0.5 195 -2.5 401 15"
stroke={color}
pathLength="1"
strokeWidth="20"
fill="none"
/>