+ 4
I am having a problem to create star animation in this codešš using JavaScript
3 Answers
+ 2
window.onload= ()=>{ //change
function stars(){
let count = 50;
let scene = document.querySelector('.scene');
let i = 0 ; //change
while(i < count){
let star = document.createElement('i');
let x = Math.floor(Math.random() * window.innerWidth);
let duration = Math.random() * 1;
let h = Math.random() * 100;
star.style.left = x + 'px';
star.style.width = 1 + 'px';
star.style.background = "white";//change
star.style.height = 50 + h + 'px';
star.style.animationDuration = duration + 's';
scene.appendChild(star);//change
i++
}
}
stars();
}
I have mentioned where applied changes
+ 4
Thanks bro š for helping me
+ 2
If you want code tell me so.