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.

Odd effects with transformOrigin property

See original GitHub issue

When animating some basic div shape, modifying the transformOrigin property in anime.js causes a different animation than animating the transform-origin property in the CSS file.

To observe the issue:

  • Watch the animation in the codepen
  • Uncomment line 3 in the javascript and watch the animation
  • Recomment the javascript line and uncomment the transform-origin property in the CSS, observe correct animation

https://codepen.io/supermandrew/pen/pWxyBJ

Any ideas why they’re different?

EDIT: Additionally, it appears that words such as ‘left’, ‘center’, etc are not supported in anime.js transformOrigin. For instance, using this for line 3 causes the animation to stop: transformOrigin: 'left center',

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
juliangarniercommented, Dec 4, 2017

It’s because you’re animating the transformOrigin property. From the default value to ‘0px 50px’. If you want to define a property, but not animating it, you should simply set it in CSS. But if you really want to use anime() to set the transformOrigin property you can define the initial and end value to be the same, like this:

transformOrigin: ['0px 50px', '0px 50px']

3reactions
cedebercommented, Nov 21, 2017

You need to give the three-value syntax:

{ transformOrigin: "50px 50px 0"}
Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS transform and transform-origin - Kevin Powell
CSS's transform property opens up a ton of options for us, and those options are pushed even further when you add in transform-origin....
Read more >
transform-origin - CSS: Cascading Style Sheets | MDN
The transform-origin CSS property sets the origin for an element's transformations.
Read more >
transform - CSS-Tricks
The transform property allows you to visually manipulate an element by skewing, rotating, translating, or scaling:
Read more >
Why does my transform: scale() property move the image to ...
It's not moving to the left. The left edge is moving, however, as is the right. Because your content is left-aligned, it appears...
Read more >
Manipulating content with CSS3 transforms - WebPlatform.org
The transform-origin property controls which point of an element the transform appears to emanate from. Adding a pixel measurement for a third parameter,...
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