User:Célian/test.js: Difference between revisions
From Test Wiki
Content deleted Content added
No edit summary |
mNo edit summary |
||
| Line 12: | Line 12: | ||
audio.play(); |
audio.play(); |
||
}); |
}); |
||
for (var i = 0; i < 100; i++) { |
|||
var confetti = document.createElement('div'); |
|||
confetti.style.position = 'absolute'; |
|||
confetti.style.width = '5px'; |
|||
confetti.style.height = '5px'; |
|||
confetti.style.background = 'red'; |
|||
confetti.style.top = Math.random() * window.innerHeight + 'px'; |
|||
confetti.style.left = Math.random() * window.innerWidth + 'px'; |
|||
document.body.appendChild(confetti); |
|||
// Animer les confettis |
|||
setInterval(function() { |
|||
confetti.style.top = parseInt(confetti.style.top) + 1 + 'px'; |
|||
if (parseInt(confetti.style.top) > window.innerHeight) { |
|||
confetti.style.top = '0px'; |
|||
} |
|||
}, 10); |
|||
} |
|||