What is going on here? [SOLVED] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is going on here? [SOLVED]

The bell slips to the bottom right and back again

27th Feb 2021, 12:35 AM
Pieter Edwards
Pieter Edwards - avatar
2 Answers
+ 5
as your animated element has already a transform (translate) applied to it, when you declare your rotation inside animation, you must repeat the translation along, else it is overrided: @keyframes mainAnim { 33% {transform:rotate(45deg) translate(-50%,-50%);} 67% {transform:rotate(-45deg) translate(-50%,-50%);} } and you probably want to move the rotation origin to something like: transform-origin:0 0; or transform-origin:0 -50%; to your #bell-icon rules ;)
27th Feb 2021, 12:53 AM
visph
visph - avatar
0
Oh that makes alot of sense visph Thanks for your help!
27th Feb 2021, 12:55 AM
Pieter Edwards
Pieter Edwards - avatar