1 /** 2 * Created by Administrator on 2016/1/26. i; 5 function draw (id){ 6 var canvas = document.getElementById(id); 7 context = canvas.getContext(‘2d‘); 8 setInterval(painting,10); 9 i=0; 10 } 11 function painting(){ 12 context.fillStyle = "red"; 13 context.fillRect(0,0,200,200); 14 context.fillStyle = "white"; 15 context.clearRect(20,20,50,50); 16 }