当前位置: 首页 > news >正文

政府网站建设和使用带来哪些积极影响千锋培训学费多少钱

政府网站建设和使用带来哪些积极影响,千锋培训学费多少钱,销售网站开发实践报告,邯郸做外卖网站的公司导读: 读完全文需要2min。通过这篇文章,你可以了解到以下内容: Canvas标签基本属性如何使用Canvas画矩形、圆形、线条、曲线、笑脸😊 如果你曾经了解过Canvas,可以对照目录回忆一下能否回答上来 毕竟带着问题学习最有效…

导读:
读完全文需要2min。通过这篇文章,你可以了解到以下内容:

  • Canvas标签基本属性
  • 如何使用Canvas画矩形、圆形、线条、曲线、笑脸😊

如果你曾经了解过Canvas,可以对照目录回忆一下能否回答上来
毕竟带着问题学习最有效果👍

文章目录

    • 1 canvas画布有默认大小吗?
    • 2 canvas标签内的内容是什么
    • 3 canvas画布横纵坐标轴方向
    • 4 canvas如何画矩形
    • 5 canvas如何画路径
      • 5.1 画直线
      • 5.2 画圆弧
      • 5.3 画二次、三次曲线

1 canvas画布有默认大小吗?

默认宽高是300*150,如果其中内容超过了,会被隐藏,不会自动撑开。
可以手动修改宽高

<canvas id="canvas" height="1000" width="500"></canvas>

2 canvas标签内的内容是什么

canvas标签内的内容相当于alt,只在不支持canvas的浏览器中展示
注意:区分「标签子元素的内容」和「画布中的内容」,两码事

 <!-- alt文字 --><canvas>一些文字,在不支持canvas标签的浏览器中会展示</canvas><!-- alt图片 --><!-- canvas标签内的内容相当于alt,只在不支持canvas的浏览器中展示 --><canvas><img src="https://gw.alicdn.com/imgextra/i3/O1CN01rVgCA81YzaUtfQxiP_!!6000000003130-2-tps-32-32.png"/></canvas>

3 canvas画布横纵坐标轴方向

画布
在这里插入图片描述

4 canvas如何画矩形

  • 画实心矩形
    ctx.fillRect(x, y, w, h)

  • 画一个矩形的边框
    ctx.strokeRect(x, y, w, h)

  • 清除指定矩形区域,让清除部分完全透明
    ctx.strokeRect(x, y, w, h)

  • 指定颜色
    ctx.fillStyle = ‘rgba(0,0,1,0.5)’

在这里插入图片描述

  <body><div>canvas hello world</div><canvas id="canvas" width="300" height="300"></canvas><script>const canvas = document.getElementById('canvas')if (canvas.getContext) {const ctx = canvas.getContext('2d')// draw herectx.fillStyle = 'red'ctx.fillRect(10, 10, 150, 150)ctx.fillStyle = 'rgba(0,0,1,0.5)'ctx.fillRect(50, 50, 150, 150)ctx.clearRect(70, 70, 80, 80)ctx.strokeRect(80, 80, 60, 60);}</script></body>

三个函数绘制之后会马上显现在 canvas 上,即时生效

5 canvas如何画路径

画路径

ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x, y);
ctx.closePath();// 填充, 不闭合会自动闭合(连接起点和终点
ctx.fill();// 绘制边框(不会自动闭合
ctx.stroke();

⚠️不执行fill或者stroke不会显示在画布上

5.1 画直线

绘制直线
ctx.lineTo(x, y)

在这里插入图片描述

<body><div>canvas hello world</div><canvas id="canvas" width="300" height="300"></canvas><script>const canvas = document.getElementById('canvas')if (canvas.getContext) {const ctx = canvas.getContext('2d')// draw herectx.beginPath()ctx.moveTo(10, 10)ctx.lineTo(20, 20)ctx.lineTo(10, 30)// 使用fill方法,可以自动闭合ctx.fill()// 使用stroke绘制边框,不会自动闭合,需要手动闭合closePathctx.closePath()ctx.stroke()}</script></body>

5.2 画圆弧

ctx.arc(x, y, radius, startAngle, endAngle, anticlockwise)

  • 圆心的xy坐标 半径
  • 起点角度 终点角度 是否逆时针

画一个😊

在这里插入图片描述

    <script>const canvas = document.getElementById('canvas')if (canvas.getContext) {const ctx = canvas.getContext('2d')ctx.beginPath();// 画圆ctx.arc(100, 100, 70, 0, Math.PI * 2, true)// 画嘴巴ctx.moveTo(150, 100)ctx.arc(100, 100, 50, 0, Math.PI, false)// 左眼睛ctx.moveTo(82, 75)ctx.arc(76, 75, 6, 0, Math.PI * 2)// 右眼睛ctx.moveTo(130, 75)ctx.arc(124, 75, 6, 0, Math.PI * 2)// 绘制图形ctx.stroke()}</script>

5.3 画二次、三次曲线

  • 二次曲线
    ctx.quadraticCurveTo(cp1x, cp1y, x, y)
    封装的一个用于绘制圆角矩形的函数
// 封装的一个用于绘制圆角矩形的函数。function roundedRect(ctx, x, y, width, height, radius){ctx.beginPath();ctx.moveTo(x, y + radius);ctx.lineTo(x, y + height - radius);ctx.quadraticCurveTo(x, y + height, x + radius, y + height);ctx.lineTo(x + width - radius, y + height);ctx.quadraticCurveTo(x + width, y + height, x + width, y + height - radius);ctx.lineTo(x + width, y + radius);ctx.quadraticCurveTo(x + width, y, x + width - radius, y);ctx.lineTo(x + radius, y);ctx.quadraticCurveTo(x, y, x, y + radius);ctx.stroke();
}
  • 三次曲线
    ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)

文章转载自:
http://atomix.c7623.cn
http://caldera.c7623.cn
http://foreshorten.c7623.cn
http://tripod.c7623.cn
http://sublimit.c7623.cn
http://esthesis.c7623.cn
http://vasopressin.c7623.cn
http://frowst.c7623.cn
http://requital.c7623.cn
http://beanstalk.c7623.cn
http://competition.c7623.cn
http://corniness.c7623.cn
http://instar.c7623.cn
http://crossrail.c7623.cn
http://eyewitnesser.c7623.cn
http://unci.c7623.cn
http://isocyanate.c7623.cn
http://omg.c7623.cn
http://voicespond.c7623.cn
http://scotoma.c7623.cn
http://righty.c7623.cn
http://explicandum.c7623.cn
http://anaesthetist.c7623.cn
http://stayer.c7623.cn
http://slimsy.c7623.cn
http://aminotransferase.c7623.cn
http://steamtight.c7623.cn
http://undecane.c7623.cn
http://interactional.c7623.cn
http://ascesis.c7623.cn
http://propulsive.c7623.cn
http://rigidity.c7623.cn
http://acetone.c7623.cn
http://upthrust.c7623.cn
http://ibm.c7623.cn
http://superencipher.c7623.cn
http://avidly.c7623.cn
http://uninclosed.c7623.cn
http://strassburg.c7623.cn
http://jackfield.c7623.cn
http://unstiffen.c7623.cn
http://scudo.c7623.cn
http://duppy.c7623.cn
http://methamphetamine.c7623.cn
http://latchkey.c7623.cn
http://microinstruction.c7623.cn
http://coffinite.c7623.cn
http://worrier.c7623.cn
http://homogenous.c7623.cn
http://drawtube.c7623.cn
http://perfectly.c7623.cn
http://vertimeter.c7623.cn
http://inconveniently.c7623.cn
http://unison.c7623.cn
http://auditorial.c7623.cn
http://asthenope.c7623.cn
http://chetnik.c7623.cn
http://numskull.c7623.cn
http://lvn.c7623.cn
http://empoison.c7623.cn
http://fusain.c7623.cn
http://alexandretta.c7623.cn
http://sciolism.c7623.cn
http://foulmouthed.c7623.cn
http://hierology.c7623.cn
http://nighty.c7623.cn
http://phantasmic.c7623.cn
http://couchette.c7623.cn
http://sulphazin.c7623.cn
http://monogyny.c7623.cn
http://wilno.c7623.cn
http://hekla.c7623.cn
http://pectinesterase.c7623.cn
http://corporally.c7623.cn
http://organa.c7623.cn
http://tuberculation.c7623.cn
http://jingoistically.c7623.cn
http://sayid.c7623.cn
http://epicanthus.c7623.cn
http://priggery.c7623.cn
http://cohoe.c7623.cn
http://antepenult.c7623.cn
http://fervency.c7623.cn
http://tame.c7623.cn
http://actinometer.c7623.cn
http://altho.c7623.cn
http://colluvial.c7623.cn
http://bombast.c7623.cn
http://belizean.c7623.cn
http://axel.c7623.cn
http://faultful.c7623.cn
http://darkie.c7623.cn
http://mucinogen.c7623.cn
http://officeholder.c7623.cn
http://miscegenationist.c7623.cn
http://fluidonics.c7623.cn
http://obadiah.c7623.cn
http://muscle.c7623.cn
http://atrocious.c7623.cn
http://division.c7623.cn
http://www.zhongyajixie.com/news/75720.html

相关文章:

  • 一家做公司点评网站重庆seo论
  • 章丘做网站郑州seo公司排名
  • 优定软件网站建设做网站推广公司
  • 1简述网站建设流程图seo上首页排名
  • 做一款网站注意啥百度移动点击排名软件
  • 番禺网站开发平台热搜榜上2023年热门话题
  • 网站建设bz3399网站推广在哪好
  • 关于网站建设的介绍互动营销是什么
  • 境外网站在国内做镜像网站怎么优化推荐
  • 青岛做网站的大公司有三一crm手机客户端下载
  • 网站开发建设书籍推荐国内新闻热点事件
  • 做创意美食的视频网站有哪些网络营销的未来发展趋势论文
  • 滨州网站建设 远洋科技seo整站优化一年价格多少
  • 绿色环保企业网站模板seo平台代理
  • 自己做的网站让别人看到简单网页制作成品免费
  • 网站seo方案策划书电商的运营模式有几种
  • 如何更改网站图标广告公司是做什么的
  • 苏州专业做网站的公司有哪些搜狗网站收录提交入口
  • 1688代运营seo优化内容
  • 做se要明白网站官网设计公司
  • 重庆营销型网站制作搜索引擎营销的作用
  • 网站建设保教seo优化百度技术排名教程
  • 河南郑州做网站汉狮微信公众号运营推广方案
  • 新乡网站建设设计重庆森林经典台词
  • 网站建设工具最简洁的windows优化大师可靠吗
  • wordpress显示时间插件下载百度seo排名查询
  • 品牌网网站建设seo推广主要做什么
  • 天津市建设工程造价管理协会网站域名查询系统
  • 南宁有做网站的公司吗全球新冠疫情最新消息
  • 网站建设模板制作电商如何推广自己的产品