motiondivision / motiondivision/motion
[BUG] SVG elements using animate() do not receive CSS animations
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 33.7k
- Forks
- 1.4k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 14
Description
1. Read the FAQs 👇
2. Describe the bug
SVG elements transformed by animate() or useAnimate() do not seem to receive CSS-derived transforms.
From what I can tell, transforms are only copied into their renderState's style if the dimensions are defined.
However, unlike SVG elements created under the motion package, SVG elements fetched by animate() do
not seem to receive dimensions, resulting in transforms never being copied over to the style.
3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
https://codesandbox.io/p/sandbox/framer-motion-enter-animation-forked-8fzrpg
4. Steps to reproduce
Steps to reproduce the behavior:
- Create an SVG with children elements
- Use animate() or useAnimate() to animate those elements via some sort of transform (e.g. x, y, translateX, etc.)
5. Expected behavior
The CSS transform should be animated and applied to the element in the same way the same element would
behave if generated by the motion package.
6. Video or screenshots
N/A
7. Environment details
Chrome, Firefox
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing packages/framer-motion/src/render/svg/utils/build-attrs.ts with packages/framer-motion/src/render/svg/config-motion.ts, then reproduce the behavior in the linked CodeSandbox using animate() or useAnimate() on SVG children. Verify the finished change by confirming transform values are copied into the element style and animate as they do for motion-generated SVG elements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100