Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let commonStyle = "transition-duration: .2s;" ;
- 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%);"];
- let currentIndex = 0;
- let images = document.querySelectorAll('img');
- function moveImages() {
- for(let i=0; i < images.length; i++) {
- let img = images[i];
- img.style = commonStyle + styleRotation[currentIndex];
- }
- currentIndex ++;
- if(currentIndex == styleRotation.length){
- currentIndex = 0;
- }
- }
- function moveAmount(amount){
- for(let i=0; i < amount; i++){
- moveImages();
- }
- }
- setInterval(moveImages, 10);
- let colors = ['red', 'green', 'blue', 'yellow', 'purple', 'black', 'white', 'orange'];
- let counter = 0;
- function changeBackgroundColor(){
- document.querySelector('body').style.backgroundColor = colors[counter];
- counter ++;
- if(counter >= colors.length-1)
- counter = 0;
- }
- setInterval(changeBackgroundColor, 10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement