@@ -5,22 +5,21 @@ import {
55 useTransform ,
66 useScroll ,
77 useVelocity ,
8- useSpring
8+ useSpring ,
99} from "framer-motion" ;
1010import { cn } from "../utils/cn" ;
1111
1212export const TracingBeam = ( {
1313 children,
14- className
14+ className,
1515} : {
1616 children : React . ReactNode ;
1717 className ?: string ;
1818} ) => {
19- // const ref = useRef<HTMLDivElement>(null);
20- const ref = useRef < HTMLDivElement > ( null ! ) as React . RefObject < HTMLElement > ;
19+ const ref = useRef < HTMLDivElement > ( null ) ;
2120 const { scrollYProgress } = useScroll ( {
2221 target : ref ,
23- offset : [ "start start" , "end start" ]
22+ offset : [ "start start" , "end start" ] ,
2423 } ) ;
2524
2625 const contentRef = useRef < HTMLDivElement > ( null ) ;
@@ -36,56 +35,48 @@ export const TracingBeam = ({
3635 useTransform ( scrollYProgress , [ 0 , 0.8 ] , [ 50 , svgHeight ] ) ,
3736 {
3837 stiffness : 500 ,
39- damping : 90
38+ damping : 90 ,
4039 }
4140 ) ;
4241 const y2 = useSpring (
4342 useTransform ( scrollYProgress , [ 0 , 1 ] , [ 50 , svgHeight - 200 ] ) ,
4443 {
4544 stiffness : 500 ,
46- damping : 90
45+ damping : 90 ,
4746 }
4847 ) ;
4948
5049 return (
5150 < motion . div
5251 ref = { ref }
53- { ...{
54- className : cn ( "relative w-full max-w-4xl mx-auto h-full" , className )
55- } }
52+ className = { cn ( "relative w-full max-w-4xl mx-auto h-full" , className ) }
5653 >
5754 < div className = "absolute -left-4 md:-left-20 top-3" >
5855 < motion . div
5956 transition = { {
6057 duration : 0.2 ,
61- delay : 0.5
58+ delay : 0.5 ,
6259 } }
6360 animate = { {
6461 boxShadow :
6562 scrollYProgress . get ( ) > 0
6663 ? "none"
67- : "rgba(0, 0, 0, 0.24) 0px 3px 8px"
68- } }
69- { ...{
70- className :
71- "ml-[27px] h-4 w-4 rounded-full border border-netural-200 shadow-sm flex items-center justify-center"
64+ : "rgba(0, 0, 0, 0.24) 0px 3px 8px" ,
7265 } }
66+ className = "ml-[27px] h-4 w-4 rounded-full border border-netural-200 shadow-sm flex items-center justify-center"
7367 >
7468 < motion . div
7569 transition = { {
7670 duration : 0.2 ,
77- delay : 0.5
71+ delay : 0.5 ,
7872 } }
7973 animate = { {
8074 backgroundColor :
8175 scrollYProgress . get ( ) > 0 ? "white" : "var(--emerald-500)" ,
8276 borderColor :
83- scrollYProgress . get ( ) > 0 ? "white" : "var(--emerald-600)"
84- } }
85- { ...{
86- className :
87- "h-2 w-2 rounded-full border border-neutral-300 bg-white"
77+ scrollYProgress . get ( ) > 0 ? "white" : "var(--emerald-600)" ,
8878 } }
79+ className = "h-2 w-2 rounded-full border border-neutral-300 bg-white"
8980 />
9081 </ motion . div >
9182 < svg
@@ -101,7 +92,7 @@ export const TracingBeam = ({
10192 stroke = "#9091A0"
10293 strokeOpacity = "0.16"
10394 transition = { {
104- duration : 10
95+ duration : 10 ,
10596 } }
10697 > </ motion . path >
10798 < motion . path
@@ -111,7 +102,7 @@ export const TracingBeam = ({
111102 strokeWidth = "1.25"
112103 className = "motion-reduce:hidden"
113104 transition = { {
114- duration : 10
105+ duration : 10 ,
115106 } }
116107 > </ motion . path >
117108 < defs >
0 commit comments