question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] SVG components forced to have a transform-origin

See original GitHub issue

See the motion.polyline component here: https://codesandbox.io/s/late-cherry-qpfsn

Expected: No transform origin if the user has set their own transform. This is probably a bug in Stylefire.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9

github_iconTop GitHub Comments

6reactions
joshuawootonncommented, Dec 3, 2020

Setting

I had the same issue. Setting this, worked for me:

style={{originX: 0.5, originY: 0.5}}

This didn’t work for me but it led me to

 style={{ originX: '50%', originY: '50%' }}

which did!!

5reactions
deadcoder0904commented, Sep 1, 2021

@mattgperry Can confirm, this is still a bug. I want to rotate an SVG on hover to 0deg from initial position -6deg so I wrote it like this:

<motion.svg
  initial={{
    rotate: -6,
  }}
  whileHover={{
    rotate: 0,
  }}
>
  {/*...*/}
</motion.svg>

But it automatically adds transform-origin: 87.936px 88.936px; to the browser when I didn’t even specify anything.

I think it should be just 0px 0px if nothing is provided.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support the 'transform-origin' property in SVG and implement ...
Issues in Layout that do not fit into any other Layout component or which span multiple Layout components. Bugs related to the top...
Read more >
CSS transform origin issue on svg sub-element - Stack Overflow
I am looking to make it scale from the elements center. How do I get the transform-origin to be set relative to the...
Read more >
Svg transform origin intermittent bug - GSAP - GreenSock
I'm animating every svg elements y position from bottom to t... ... Funnily enough I can't seem to get the codepen to reproduce...
Read more >
Styling — SVG 2
Elements in an SVG document can be styled using CSS. ... In SVG 1.1, support for inline style sheets using the 'style' element...
Read more >
An Animated Tale of SVG Transforms - DockYard
I was incorrect in my approach to transforming SVG child elements. ... This issue isn't present in transform-origin properties that have ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found