首页 > Windows开发 > 详细

html5 canvas simple drawing

时间:2014-12-27 21:44:47      阅读:445      评论:0      收藏:0      [点我收藏+]

var c = canvas.getContext("2d");//get canvas 2d context

canvas including a proposed 3D context;

c.fillStyle("#ffffff");//rawing canvas background color

c.fillRectangle(sx,sy,ex,ey);//drawing a rectanle ,the (sx,sy) is start point,(ex,ey) is end point

c.font = "20px"//the canvas font size is 20 pixel

c.textBaseline = "top"//the text vertical position

c.fillText("Hello",100,100);//drawing a text to canvas,The three parameters of this method are text string,x position,y position

c.strokeStyle = "#ffffff";//set a color for the stroke(the border of the box)

c.strokeRect(0,0,100,100);//upper left x and y coordinates ,and the lower right x and y coordinates

html5 canvas simple drawing

原文:http://www.cnblogs.com/jinxiao/p/4189203.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!