首页 > 其他 > 详细

2D上下文

时间:2018-11-20 00:51:52      阅读:199      评论:0      收藏:0      [点我收藏+]

js中说明的上下文表示的意思为C++中作用域(个人理解),因此2D上下文说明的是这个2D的作用域

像素:用来描述图片清晰度的小矩阵

填充和描边

填充context.fillStyle = "yellow";

描边context.strokeStyle = "red";

如果单纯的使用这两个属性,不会再网页上面显示的。

var drawing = document.getElementById("drawing");
if(drawing.getContext)
{
  var context = drawing.getContext("2d");
  context.strokeStyle = "red";
  context.fillStyle = "yellow";
  context.fillRect(20,20,150,100)
  context.strokeRect(20,20,150,100)
  console.log(context)
}

 

2D上下文

原文:https://www.cnblogs.com/MyUniverse/p/9986684.html

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