Advertisement
MatthijsFontys

Epilepsie script 2.0

Sep 12th, 2020
1,320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let commonStyle = "transition-duration: .2s;" ;
  2. let styleRotation = ["transform: rotate(0deg) scale(1); filter: invert(0%);"  ,"transform: rotate(90deg) scale(2); filter: invert(100%);", "transform: rotate(180deg) scale(1) ; filter: invert(0%);", "transform: rotate(270deg) scale(2); filter: invert(100%);"];
  3. let currentIndex = 0;
  4. let images = document.querySelectorAll('img');
  5. function moveImages() {
  6.     for(let i=0; i < images.length; i++) {
  7.         let img = images[i];
  8.         img.style = commonStyle + styleRotation[currentIndex];
  9.     }
  10.     currentIndex ++;
  11.     if(currentIndex == styleRotation.length){
  12.         currentIndex = 0;
  13.     }
  14. }
  15.  
  16. function moveAmount(amount){
  17.     for(let i=0; i < amount; i++){
  18.         moveImages();
  19.     }
  20. }
  21.  
  22. setInterval(moveImages, 10);
  23.  
  24. let colors = ['red', 'green', 'blue', 'yellow', 'purple', 'black', 'white', 'orange'];
  25. let counter = 0;
  26.  
  27. function changeBackgroundColor(){
  28.     document.querySelector('body').style.backgroundColor = colors[counter];
  29.     counter ++;
  30.     if(counter >= colors.length-1)
  31.         counter = 0;
  32. }
  33.  
  34. setInterval(changeBackgroundColor, 10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement