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] Issue with CSS transform

See original GitHub issue

Hi,

If I apply the framer motion animation on an element which is centered using the following CSS code:

.center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
}

Framer motion, will reset the transform property to 0. So it won’t be center anymore.

Here is a sample on CodeSandbox: https://codesandbox.io/s/fancy-hooks-4gj59?file=/src/App.js

Is there anyway to fix this behavior?

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mattgperrycommented, Jan 4, 2021

There is also a transformTemplate prop you can use to output custom transform strings.

1reaction
artemmatiushenko1commented, Mar 24, 2022

Is it possible to use layoutId together with transform template? I have a circle div and I need it to make tranform: translate(50%) in order to properly center it relatively to navigation item. But when I use tranform in css it overrides to transform none by framer. If I use transform template shared layout animation doesn’t perform

 {selectedPage === path ? (
      <S.Circle
        transformTemplate={template}
        style={{ y: '50%' }}
        layoutId="circle"
      />
    ) : null}```
Read more comments on GitHub >

github_iconTop Results From Across the Web

Safari rendering bug with CSS transform - a depth sorting / z ...
CSS transition transform z-index conflict in Safari (Works on Chrome / FF) CSS Translate Issue on Safari.
Read more >
Reraster during CSS transform transitions to keep things crisp ...
Issue 224913 : Reraster during CSS transform transitions to keep things crisp *for ganesh mode* This issue has been migrated to Launch, see...
Read more >
CSS translate with transition and overflow creates jumpy ...
This problem first appeared in Fx49(win10). Status: UNCONFIRMED → NEW. Ever confirmed: true. Keywords: regression ...
Read more >
Debugging layout repaint issues triggered by CSS Transition
As seen from the code, the transition is applied to opacity and transform , which are the recommended properties to use when moving...
Read more >
Is CSS Transform Dead? - Web Dev Simplified Blog
CSS just added individual rotate, translate, and scale properties ... If we swap to using CSS variables we can now get around this...
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