+ 4

Rotate animation on point inside the element

I have an element with a width of 4px and a height of 54px, how do I get it to rotate 2px from the bottom and 2px from the left, inside of the element (kinda like a pointer spinning in the center of a circle)

28th Jun 2017, 6:45 PM
MCJEH
MCJEH - avatar
2 Answers
+ 8
Use( transform-origin:50% 4%; ) in CSS to change the point of rotation at which transform:rotate(); works , by default its value is(50% 50%) i.e. it rotates from the middle . In your case (50% 4%)as 2/4*100=50 and 2/54*100=4 average.
28th Jun 2017, 7:05 PM
Utkαrsh
Utkαrsh - avatar
28th Jun 2017, 8:55 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar