网站首页 > 基础教程 正文
html
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Canvas element size: 600 x 300, Canvas drawing surface size: 600 x 300</title> <style> body { background: skyblue; } #canvas { margin: 10px; padding: 10px; background: white; border: thin inset gray; } </style> </head> <body> <canvas id='canvas' width='600' height='300'> Canvas not supported </canvas> <script src='example.js'></script> </body> </html>
js
var canvas = document.getElementById('canvas'), context = canvas.getContext('2d'); //???????? context.font = '38px Arial'; //?????????? context.fillStyle = 'red'; //????????????? context.strokeStyle = 'blue'; //????? context.fillText("???????365", canvas.width/2 - 150,canvas.height/2 + 15); //?????? context.strokeText("???????365", canvas.width/2 - 150,canvas.height/2 + 15 );
???????
???????
?????????????????????????????????????
???????????????????
???
????????????????????????£??????л??
猜你喜欢
- 2024-10-12 web前端:canvas动画彩色气泡,类直播间点赞效果实现
- 2024-10-12 HTML使用Canvas绘制动画时钟 canvas绘制钟表
- 2024-10-12 三个绘图工具类详解 常用的绘图工具有哪些,分别有什么用
- 2024-10-12 如何用不到 2KB 的 JavaScript 代码写一个 3D 赛车游戏?
- 2024-10-12 VUE动态生成二维码并利用canvas合成海报图
- 2024-10-12 JavaScript+Canvas实现自定义画板
- 2024-10-12 JavaScript 中的画布 js实现画板
- 2024-10-12 canvas绘制饼图的方法介绍(代码) canvas画饼状图百分比
- 2024-10-12 H5表白特效——Canvas实现粒子涂鸦效果
- 2024-10-12 h5-自定义生成海报(头条初吻,轻虐)
- 最近发表
- 标签列表
-
- gitpush (61)
- pythonif (68)
- location.href (57)
- tail-f (57)
- pythonifelse (59)
- deletesql (62)
- c++模板 (62)
- css3动画 (57)
- c#event (59)
- linuxgzip (68)
- 字符串连接 (73)
- nginx配置文件详解 (61)
- html标签 (69)
- c++初始化列表 (64)
- exec命令 (59)
- canvasfilltext (58)
- mysqlinnodbmyisam区别 (63)
- arraylistadd (66)
- node教程 (59)
- console.table (62)
- c++time_t (58)
- phpcookie (58)
- mysqldatesub函数 (63)
- window10java环境变量设置 (66)
- c++虚函数和纯虚函数的区别 (66)