电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

[HTML5资料]Canvas教程VIP专享VIP免费

[HTML5资料]Canvas教程_第1页
[HTML5资料]Canvas教程_第2页
[HTML5资料]Canvas教程_第3页
HTML5 资料 1 Canvas 教程 是一个新的用于通过脚本(通常是JavaScript)绘图的HTML 元素。例如,他可以用于绘图、制作图片的组合或者简单的动画(当然并不那么简单)。It can for instance be used to draw graphs, make photo compositions or do simple (and not so simple) animations. 1.1 基本用法 Basic usage 元素 Let's start this tutorial by looking at the element itself. 让我们从元素的定义开始吧。 This looks a lot like the element, the only difference is that it doesn't have the src and alt attributes. 看起来很像,唯一不同就是它不含 src 和 alt 属性。The element has only two attributes - width and height. These are both optional and can also be set using DOM properties or CSS rules.它只有两个属性,width 和 height,两个都是可选的,并且都可以 DOM 或者 CSS 来设置。 When no width and height attributes are specified, the canvas will initially be 300 pixels wide and 150 pixels high.如果不指定 width 和 height,默认的是宽 300 像素,高 150 像素。The element can be sized arbitrarily by CSS, but during rendering the image is scaled to fit its layout size. (If your renderings seem distorted, try specifying your width and height attributes explicitly in the attributes, and not with CSS.)虽然可以通过 CSS 来调整 canvas 的大小,但渲染图像会缩放来适应布局的(如果你发现渲染结果看上去变形了,不必一味依赖 CSS,可以尝试显式指定 canvas 的width 和 height 属性值)。 The id attribute isn't specific to the element but is one of default HTML attributes which can be applied to (almost) every HTML element (like class for instance). It's always a good idea to supply an id because this makes it much easier to identify it in our script. id 属性不是<...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部