<script><br><br> function start(){<br><br> var array=new Array();<br><br> var canvas=document .getElementById("mycanvas");<br><br> var context=canvas.getContext("2d");<br><br> for(var i=0;i<50;i ){<br><br> var Showsnow=new showsnow();<br><br> array.push(Showsnow);<br><br> }<br><br> <BR> time=setInterval(function (){<br> <br> context.clearRect(0,0,canvas.width,canvas.height);<BR> for(var i=0;i<array.length;i ){<br><br> <BR> array[ i].move();<BR> array[i].draw(context);<br><br> }<br><br> },500);<br><br> }<BR> function showsnow (){<BR> var y=parseInt(Math.random()*50)*10;<br><br> var x=parseInt(Math.random()*80)*10;<br><br> this.draw=function(context){<br><br> <BR> context.font="50px Calibri";<BR> context.fillText("*",x,y);<br><br> <BR> }<BR> this.move=function(){<BR> y =20;<br><br> if(y>600){<br> y=0;<br> }<br> }<br> }<br> </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn