Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pl-PL">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>CSS Anim</title>
- <style>
- .animacja {
- animation: move .4s;
- }
- .player {
- background-color: blueviolet;
- width: 100px;
- height: 100px;
- position: absolute;
- top: 200px;
- left: 50px;
- }
- @keyframes move {
- to{transform: translateX(100px);}
- }
- </style>
- </head>
- <body>
- <button id='steer' onclick="animacja();">MOVE NIGGASa</button>
- <div class="player"></div>
- <script>
- function animacja() {
- const player = document.querySelector('.player');
- player.classList.toggle('animacja');
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement