canvas(11/28)--------基础入门
2017-11-29 10:45
162 查看
canvas的基础使用
html上的代码:
example.js:
canvas状态的保存与恢复:
html上的代码:
<html> <head> <title>michelleswan</title> <style> body{ background: #dddddd; } #canvas { margin: 10px; padding: 10px; background: #ffffff; border: thin inset #aaaaaa; } </style> </head> <body> <canvas id="canvas" width="600" height="300">canvas not supported</canvas> <script src="example.js"></script> </body> </html>
example.js:
var canvas = document.getElementById('canvas'); context = canvas.getContext('2d'); context.font = '38px Arial'; context.fillStyle = 'cornflowerblue'; context.strokeStyle = 'blue'; context.fillText('Hello Cancas',canvas.width/2-150,canvas.height/2+15); context.strokeText('hello canvas',canvas.width/2-150,canvas.height/2+15);
canvas状态的保存与恢复:
相关文章推荐
- 11-Linux基础入门(九)-Linux的通配符
- [BX]和loop指令06 - 零基础入门学习汇编语言28
- H5 canvas基础入门到捕鱼达人小游戏实现(1)
- H5 canvas基础入门到捕鱼达人小游戏实现(3)-canvas运动入门,渐变,文字渲染,阴影
- H5 canvas基础入门到捕鱼达人小游戏实现(4)canvas事件处理和图形动作
- 数组06 - 零基础入门学习C语言28
- 11-Linux基础入门(九)-Linux的通配符
- [BX]和loop指令06 - 零基础入门学习汇编语言28
- Android基础入门教程——8.3.16 Canvas API详解(Part 1)
- 寄存器(CPU工作原理)06 - 零基础入门学习汇编语言11
- 11-Python3从入门到实战—基础之生成器和迭代器
- JAVA入门[11]-jsp几点基础语法
- 开始玩hadoop 11 --Hbase 入门 shell基础命令
- Android基础入门教程——8.3.17 Canvas API详解(Part 2)剪切方法合集
- Android基础入门教程——8.3.18 Canvas API详解(Part 3)Matrix和drawBitmapMash
- Linux基础入门及系统管理01-Linux用户管理命令详解11
- 寄存器(CPU工作原理)06 - 零基础入门学习汇编语言11
- Android基础入门教程——8.3.16 Canvas API详解(Part 1)
- uva297 - Quadtrees 入门经典II 第六章 数据结构基础 例题6-11
- HTML基础入门:Canvas+视频播放+音频播放