canvas知识总结
(编辑:jimmy 日期: 2024/11/18 浏览:3 次 )
1.基础知识
canvas元素绘制图像的时候有两种方法,分别是
context.fill()//填充 context.stroke()//绘制边框
style:在进行图形绘制前,要设置好绘图的样式
context.fillStyle//填充的样式 context.strokeStyle//边框样式 context.lineWidth//图形边框宽度
context.arc(centerx圆心横左边,centery圆心纵坐标,radius半径,startingAngle起始弧度值,endingAngle结束弧度值,anticlockwise='false'顺时针默认false)
2.绘制非填充线段
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="http://r01.uzaicdn.com/content/v1/styles/subject.css"> <link rel="stylesheet" href="styles/lianxi.css"> <script src="/UploadFiles/2021-04-02/core.js">3.绘制填充图形
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="http://r01.uzaicdn.com/content/v1/styles/subject.css"> <link rel="stylesheet" href="styles/lianxi.css"> <script src="/UploadFiles/2021-04-02/core.js">4.绘制圆弧
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="http://r01.uzaicdn.com/content/v1/styles/subject.css"> <link rel="stylesheet" href="styles/lianxi.css"> <script src="/UploadFiles/2021-04-02/core.js">5.绘制矩形
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="http://r01.uzaicdn.com/content/v1/styles/subject.css"> <link rel="stylesheet" href="styles/lianxi.css"> <script src="/UploadFiles/2021-04-02/core.js">6.绘制文本
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="http://r01.uzaicdn.com/content/v1/styles/subject.css"> <link rel="stylesheet" href="styles/lianxi.css"> <script src="/UploadFiles/2021-04-02/core.js">上一篇:assert()函数用法总结(推荐)<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="http://r01.uzaicdn.com/content/v1/styles/subject.css"> <link rel="stylesheet" href="styles/lianxi.css"> <script src="/UploadFiles/2021-04-02/core.js">7.图片操作
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="http://r01.uzaicdn.com/content/v1/styles/subject.css"> <link rel="stylesheet" href="styles/lianxi.css"> <script src="/UploadFiles/2021-04-02/core.js">以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!
下一篇:基于JavaScript实现自定义滚动条