Hello everyone, this is my first post so sorry if I'm wrong in something.
I'm unable to create a Codepen but I've created a Codesandbox, I hope it's good anyway.
What I want to do is very easy: animate an svg line tag. So I created a tweenMax.to animation but it seems not to work. Why?
export const AnimatedLine = ({ x1, y1, x2, y2, ...props }) => {
const lineRef = useRef(null)
useEffect(() => {
if (lineRef.current) {
TweenMax.to(lineRef.current, 1, {
x1: x1,
y1: y1,
x2: x2,
y2: y2
})
}
}, [x1, y1, x2, y2])
return <line ref={lineRef} x1={x1} y1={y1} x2={x2} y2={y2} {...props} />
}
When I run it, I get: