首页 > 代码库 > html5 canvas simple drawing
html5 canvas simple drawing
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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。