Advertisement
1xptolevitico69

Css animation bars

Jan 5th, 2022
1,039
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.17 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Css animation bars</title>
  8.     <style>
  9.  
  10.     .clone {
  11.       position: absolute;
  12.       top: 10px;
  13.       left: 10px;
  14.       text-decoration: none;
  15.       background-color: red;
  16.       width: 150px;
  17.       text-align: center;
  18.       color: snow;
  19.       font-family: arial black;
  20.       padding: 5px 20px;
  21.     }
  22.  
  23.   container {
  24.   position: relative;
  25.   width: 600px;
  26.   margin: 100px auto;
  27.   display: block;
  28. }
  29. audio {
  30.   position: absolute;
  31.   left: 40px;
  32.   bottom: 0px;
  33.   border: 1px solid red;
  34.   outline: none;
  35.   height: 40px;
  36.   background-color: rgba(128, 128, 128, 0.1);
  37. }
  38. .box {
  39.   position: absolute;
  40.   left: 0;
  41.   bottom: 50px;
  42.   display: none;
  43. }
  44. span {
  45.   position: absolute;
  46.  
  47.   left: 360px;
  48.   top: -40px;
  49.   font-size: 20px;
  50.   font-family: arial black;
  51. }
  52.  
  53. #_1 {
  54.   top: 40px;
  55.   height: 10px;
  56.   width: 5px;
  57.   position: absolute;
  58.   background-color: red;
  59.   animation: foo 1s linear infinite;
  60. }
  61. #_2 {
  62.   left: 7px;
  63.   top: 40px;
  64.   height: 10px;
  65.   width: 5px;
  66.   position: absolute;
  67.   background-color: green;
  68.   animation: fii 1s linear infinite 0.1s;
  69. }
  70. #_3 {
  71.   left: 13px;
  72.   top: 40px;
  73.   height: 10px;
  74.   width: 5px;
  75.   position: absolute;
  76.   background-color: navy;
  77.   animation: fee 1s linear infinite 0.5s;
  78. }
  79.  
  80. #_4 {
  81.   left: 19px;
  82.   top: 40px;
  83.   height: 10px;
  84.   width: 5px;
  85.   position: absolute;
  86.   background-color: maroon;
  87.   animation: faa 1s linear infinite 0.8s;
  88. }
  89.  
  90. #_5 {
  91.   left: 25px;
  92.   top: 40px;
  93.   height: 10px;
  94.   width: 5px;
  95.   position: absolute;
  96.   background-color: orange;
  97.   animation: fuu 1s linear infinite 0.3s;
  98. }
  99.  
  100. @keyframes foo {
  101.   50% {
  102.     top: 10px;
  103.     height: 40px;
  104.   }
  105. }
  106. @keyframes fii {
  107.   50% {
  108.     top: 10px;
  109.     height: 40px;
  110.   }
  111. }
  112. @keyframes fee {
  113.   50% {
  114.     top: 10px;
  115.     height: 40px;
  116.   }
  117. }
  118.  
  119. @keyframes faa {
  120.   50% {
  121.     top: 10px;
  122.     height: 40px;
  123.   }
  124. }
  125.  
  126. @keyframes fuu {
  127.   50% {
  128.     top: 10px;
  129.     height: 40px;
  130.   }
  131. }
  132.  
  133.  
  134.     </style>
  135. </head>
  136. <body>
  137.  
  138.     <container>
  139.         <box class='box'>
  140.           <div id='_1'></div>
  141.           <div id='_2'></div>
  142.           <div id='_3'></div>
  143.           <div id='_4'></div>
  144.           <div id='_5'></div>
  145.         </box>
  146.         <audio id='audio' src='https://1xpto.netlify.app/audio/bass.mp3' controls></audio>
  147.         <span id='sp'>Status OFF</span>
  148.       </container>
  149.  
  150.  
  151.   <a class='clone' title="Subscribe and hit the notification bell for more updates. It's free." href='https://www.youtube.com/channel/UCqLpDK0eOsG1eEeF9jOUZkw'>SUBSCRIBE</a>
  152.  
  153.  
  154.     <script>
  155.                
  156.  
  157.                box = document.getElementsByClassName("box")[0];
  158.  
  159. audio.onplay = () => {
  160.   foo();
  161. sp.innerHTML='Status ON';
  162. };
  163.  
  164. audio.onended = () => {
  165.   sortir();
  166. sp.innerHTML='Status OFF';
  167. };
  168.  
  169. audio.ontimeupdate = () => {
  170.   if (audio.paused) {
  171.     sortir();
  172. sp.innerHTML='Status OFF';
  173.   }
  174. };
  175.  
  176. function foo() {
  177.   box.style.display = "block";
  178. }
  179.  
  180. function sortir() {
  181.   box.style.display = "none";
  182. }
  183.  
  184.  
  185.     </script>
  186. </body>
  187. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement