Box rotation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Box rotation

I want to move a box to perform an infinity 360 deg rotation.The box must in a container. Any help will be highly appropriated . In JavaScript plz

3rd May 2021, 6:59 PM
techsway
techsway - avatar
2 Answers
+ 2
If you want an element to be in an endless rotation animation, use CSS. Check the answer to this: https://stackoverflow.com/questions/6410730/css-endless-rotation-animation Here is some JavaScript that uses CSS to rotate the "js" tag on this page. If you're on a laptop or desktop, open your browser's JavaScript console and paste this to see the "js" tag rotate infinitely: var e = document.querySelector('[data-value="js"]'); var style = document.createElement('style'); style.innerHTML = `@keyframes rotating { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }`; document.querySelector('head').appendChild(style); e.style.animation = 'rotating 2s linear infinite';
3rd May 2021, 7:05 PM
Josh Greig
Josh Greig - avatar
+ 1
Josh and Miriele,Thank you.
3rd May 2021, 7:19 PM
techsway
techsway - avatar