-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
I'm trying to animate the viewBox for an SVG component wrapped using motion(), but it doesn't seem to work e.g
import { motion } from "framer-motion";
import { forwardRef } from "react";
const SvgComponent = forwardRef((props, ref) => (
<svg {...props} ref={ref} viewBox="0 0 100 100" width="400" height="400">
....
</svg>
));
export default function App() {
const MotionSvgComponent = motion(SvgComponent);
return (
<div>
<MotionSvgComponent
animate={{
viewBox: [
"0 0 100 100",
"0 0 50 50",
"50 0 50 50",
"0 50 50 50",
"50 50 50 50",
"0 0 100 100"
]
}}
transition={{
duration: 10
}}
/>
</div>
);
}Other animation properties work fine e.g
<MotionSvgComponent
animate={{
x: 50,
}}
/>Sandbox
https://codesandbox.io/s/agitated-wilbur-wmzhf
Steps to reproduce the behavior
The sandbox shows both a wrapped component and an example that shows the viewBox is animated when using motion.svg.
What should happen
Both components should animate the same way.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working