MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 19: Line 19:
e.style.rotate = `${ rand(-3, 3) }deg`
e.style.rotate = `${ rand(-3, 3) }deg`
})
})
counter = rand(1000, 10000)
counter = rand(5000, 15000)
setTimeout(() => { setRandomRotations() }, counter)
setTimeout(() => { setRandomRotations() }, counter)
}
}
Line 27: Line 27:
// Function to generate a random bright color
// Function to generate a random bright color
function getRandomBrightColor() {
function getRandomBrightColor() {
   const min = 200; // Minimum value for bright colors
   const min = 75; // Minimum value for bright colors
   const r = Math.floor(Math.random() * (255 - min) + min);
   const h = Math.floor(Math.random() * (220));
   const g = Math.floor(Math.random() * (255 - min) + min);
   const s = Math.floor(Math.random() * (100 - min) + min);
   const b = Math.floor(Math.random() * (255 - min) + min);
   const l = Math.floor(Math.random() * (100 - min) + min);
   return `rgb(${r},${g},${b})`;
   return `hsl(${h},${s}%,${l}%)`;
}
}


Line 48: Line 48:
     element.style.backgroundColor = getRandomBrightColor();
     element.style.backgroundColor = getRandomBrightColor();
   });
   });
  counter = rand(1000, 10000)
counter = rand(5000, 15000)
  setTimeout(() => { setBackgroundColors() }, counter)
setTimeout(() => { setBackgroundColors() }, counter)
}
}