var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); rectangle = new Path2D(); rectangle.rect(10,10,50,50); var circle = new Path2D(); circle.moveTo(125,35); circle.arc(100,35,25,0,2*Math.PI); ctx.stroke(rectangle); ctx.fill(circle);
今天就讲到这里,下节课我们讲解:canvas颜色/透明度
关注公众号,博客更新即可收到推送