Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): 让大量雪花无序的飞舞起来,让其栩栩如生 #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions 飘雪.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<body>

</body>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
// 窗口大小
var oPageX=window.screen.width;
Expand All @@ -44,17 +43,23 @@
};
this.createSnow();
this.snowMove=function(){
this.node.style.top=parseInt(this.node.style.top)+this.yspeed+'px';//垂直方向运动
this.node.style.left=parseInt(this.node.style.left)+this.xsin*Math.sin(this.xspeed)+'px';
this.node.style.top=parseFloat(this.node.style.top)+this.yspeed+'px';//垂直方向运动
this.node.style.left=parseFloat(this.node.style.left)+this.xsin*Math.sin(this.xspeed)+'px';
this.node.style.fontSize=this.size+'px';
// this.node.style.color='rgb('+Math.ceil(Math.random()*255)+','+Math.ceil(Math.random()*255)+','+Math.ceil(Math.random()*255)+')';
// this.node.style.color='rgb('+Math.ceil(Math.random()*255)+','+Math.ceil(Math.random()*255)+','+Math.ceil(Math.random()*255)+')';
};
}
// 创建雪花
function createSnow(){
aSnow.push(new snow(Math.random()*oPageX,-50,0.02+Math.random()/10,1+Math.random(),Math.random()*30,20+Math.random()*30));
aSnow.push(new snow(
Math.random()*oPageX,
-50,
-0.1+Math.random()/5,
1+Math.random(),
Math.random()*30,
20+Math.random()*30));
}
setInterval(createSnow,1000);//一秒钟创建一个雪花
setInterval(createSnow,100);//一秒钟创建10个雪花
// 雪花移动函数
function snowMove(){
for(var j=0;j<aSnow.length;j++){
Expand Down