Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width">
- <style>
- img { width:250px;margin:200px auto;display:block;
- border:5px solid red;padding:5px; }
- </style>
- </head>
- <body>
- <img id='image' onclick='spin()' src='https://images.pexels.com/photos/416160/pexels-photo-416160.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'/>
- <script>
- i=0;
- function spin(){
- x = setInterval(()=>{
- i++;
- image.style.transform='rotate('+i+'deg)';
- if(i==360){clearInterval(x);}
- },16.666); // 60fps
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement