当前位置:网站首页>Canvas study notes
Canvas study notes
2022-04-21 10:28:00 【Dawn_ Maple】
html
<canvas style="border: solid 1px red" id="cvs"><canvas>
js
Draw a line
let cvs = document.querySelect('#cvs'); // Get canvas elements
let ctx = ctx.getContent('2d'); // Get toolset
ctx.moveTo(40, 40); // (x, y) Select the starting point
ctx.lineTo(80, 80); // Draw the line to the target point
// At this time, all operations are only saved in memory , Not displayed on the page
ctx.storke(); // draw , Make the above content appear on the page
Draw the triangle and change the color 、 Line width
var cvs = document.getElementById('cvs'); // Get canvas elements
var ctx = cvs.getContext("2d"); // Get toolset
ctx.moveTo(50, 50); // Locate the start position
ctx.lineTo(150, 50); // The first point
ctx.lineTo(80, 100); // Second points
ctx.closePath(); // Closed path , It can also be used here ctx.lineTo(50, 50) The effect is the same
ctx.strokeStyle = 'red'; // Set the color of the drawing
ctx.lineWidth = 20; // Set line width
ctx.stroke(); // draw
版权声明
本文为[Dawn_ Maple]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211023469330.html
边栏推荐
- 移动通信平台的搭建(可语音可视屏可收发短信)
- 24张图攻克border-image
- L1-052 2018我们要赢 (5 分)
- 2022信息与未来预备刷题3《New Online Judge 1059: 字符串排序》
- Impact of AOT and single file release on program performance
- Cisco Packet Tracer实验集合
- The most easy to understand dependency injection and control inversion
- 数字经济-新经济指数(2017-2022)&31省数字经济测算(2013-2020)两大维度指标
- Exon bed file acquisition
- DHCP协议工作流程
猜你喜欢
随机推荐
SAP导出物料库存量代码
Digital Economy & Green Innovation matching: Green Patent matching data of digital finance enterprises of 3169 companies in China, 2011-2019
Uniapp wechat applet clicks the button to call wechat payment
HMS Core 6.4.0版本发布公告
英伟达、万向、风语筑、追梦者基金……大咖漫谈“元宇宙与产业新机遇”丨2022元宇宙云峰会...
Rose again. In April, the salary of programmers across the country was released, and it became the salary ceiling of the industry? I'm excited after reading it
MKL and vs2019 configuration method
【并发编程044】CAS循环时间太长,会有什么问题?
【数据库第十二次作业-存储过程】
使用类知识点总结
L1-047 装睡 (10 分)
Shell变量$#,$@,$0,$1,$2,${},##,%%使用解释以及好用的shell格式化工具
自动化运维平台未来的发展前景?
7_数据分析—评估
L1-050 倒数第N个字符串 (15 分)
shell脚本修改文件名和权限
Pytorch学习笔记(1)检查torch、cuda,张量的创建
Cilcate环境搭建
MKL与VS2019配置方法
两两数之和









