| 	function draw(){ 		//先给canvas设置一些样式 		context.fillStyle = "rgba(0,0,0,0.05)"; 		context.fillRect(0,0,W,H);     //满屏填充 		context.font = "700 "+fontSize+"px  微软雅黑"; 		context.fillStyle ="#00cc33"; 		//并写入画布中 		for(var i=0;i<list;i++){ 			var index = Math.floor(Math.random() * str.length); 			var x = i*fontSize; 			var y = drops[i] *fontSize; 			context.fillText(str[index],x,y); 			//时间改变的时候就改变每次文字的起点 			if(y >= canvas.height && Math.random() > 0.99){ 				drops[i] = 0; 			} 			drops[i]++; 		} 	}; 	//最后调用该函数 并每30毫秒调用一次 	draw(); 	setInterval(draw,30); };
 |