2019-06-05 09:52:30 HTML

HTML

Copy Copied! Full
<div id="cercle2"></div> <style> #cercle2 { min-height: 100vh; background-size: 100px 100px; background-color: midnightblue; background-position: 0 0, 50px 50px; background-image: radial-gradient(crimson 20%, transparent 0), radial-gradient(crimson 20%, transparent 0); } </style> <script> function randamColorCode(){ return ('0'+ (Math.ceil(Math.random() * ( 255 - 0 ) + 0)).toString(16)).slice(-2); } setInterval(function(){ let r1 = randamColorCode(); let g1 = randamColorCode(); let b1 = randamColorCode(); let cercleColor1 = r1+g1+b1; let r2 = randamColorCode(); let g2 = randamColorCode(); let b2 = randamColorCode(); let cercleColor2 = r2+g2+b2; let size = Math.ceil(Math.random() * ( 50 - 5 ) + 5); document.getElementById('cercle2').style.backgroundColor = cercleColor1; document.getElementById('cercle2').style.backgroundImage = `radial-gradient(#${cercleColor2} ${size}%, transparent 0px), radial-gradient(#${cercleColor2} ${size}%, transparent 0px)`; }, 170); </script>