css部分代码
**{margin: 0;padding: 0;}
#container{
width: 100%;
height: 1000px;
cursor: pointer;
position: relative;
overflow: hidden;
background: url(../../day17/代码/img/bg.jpg) repeat fixed center;
}
.fire{
width: 20px;
height:20px;
position: absolute;
bottom: 0;
border-radius: 50%;
}
.small-fire{
width: 10px;
height:10px;
position: absolute;
border-radius: 50%;
}*
body部分代码
*<div id="container"></div>*
js部分代码
class Fire{
constructor(pos){
this.cont = document.getElementById("container");
this.x = pos.x;
this.y = pos.y;
}
create(){
this.f = document.createElement("div");
this.f.className = "fire";
this.f.style.background = randomColor();
this.cont.appendChild(this.f);
this.f.