Odd effects with transformOrigin property
See original GitHub issueWhen 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:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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']
You need to give the three-value syntax: