散列线条
<canvas id="cc" width="798" height="1131"></canvas>
$(document).ready(function(){ // lili(); var i=0; ui(i); }); var colors = ['#e37f7f','#e37fd6','#b57fe3','#7f90e3','#7fcfe3','#7fe3d4','#7fe399','#b5e37f','#e3e27f','#e3ba7f','#e3a77f','#e37f7f','#e37fd6','#b57fe3','#7f90e3','#7fcfe3','#7fe3d4','#7fe399','#b5e37f','#e3e27f','#e3ba7f','#e3a77f'];//全局变量 //散列1线条 function ui(i){ if(i<18){ i=i+1; }else if(i=19){ i=0 } var mc=document.getElementById('cc'); var context=mc.getContext('2d'); var a=Math.floor(Math.random()*100),b=Math.floor(Math.random()*110),c=Math.floor(Math.random()*120),d=Math.floor(Math.random()*130); context.beginPath(); context.moveTo(a,b); context.lineTo(c,d); context.strokeStyle=colors[i]; context.closePath(); context.stroke(); setTimeout('ui('+i+')',1000); }