HTML画二维圆(web)
教程管理员 发布于2023-09-30 10:00 HTML教程 187
简介:
HTML画二维圆(web)
代码:
<template>
<div id="app-container">
<div style="text-align: center">
<h2>方案展示</h2>
<div style=" display: flex;justify-content: center;align-items: center;">
<!-- width和height分别是css的宽高的两倍,是为了防止画出来的图像模糊-->
<canvas id="plan" width="2400" height="1200">
</canvas>
</div>
</div>
</div>
</template>
<script>
export default {
name: "TubeCaculatePlan",
data() {
return {}
},
methods: {
paint(radius, x, y, color) {
let canvasPlan = document.getElementById("plan")
let draw = canvasPlan.getContext("2d")
draw.beginPath()
// 根据角度来设置画圆的范围,可以不画整圆 anticlock:是否采用逆时针
draw.arc(x, y, radius, 0, Math.PI * 2, false)
draw.closePath()
//给圆设置背景颜色,不设置默认是黑色
draw.fillStyle = color
//给圆图色
draw.fill()
//设置边的颜色
draw.strokeStyle = 'rgba(0, 0, 0, 1)'
//设置圆的边
draw.stroke()
}
},
mounted() {
this.paint(500, 600, 600,'rgba(255, 0, 0, 1)')
},
}
window.onload = function () {
}
</script>
<style scoped>
#plan {
width: 1200px;
height: 600px;
border: 2px solid #102b6a;
}
</style>
效果:
- 上一篇:HTML中调用XML数据实例
- 下一篇:H5学习从0到1-xhtml语法(15)
相关推荐
- 10-04 在HTML中取得请求中的参数
- 10-04 SharePoint 2013 母版页取消和HTML页关联
- 10-04 29行代码使用HTML5 Canvas API绘制一颗红心
- 10-04 浏览器加载和渲染html的顺序,Div和Table的区别
- 10-04 《HTML5完美游戏开发》——2.6 Processing.js实例和整合
- 10-04 如何关闭Struts2的webconsole.html
- 10-04 《HTML5 开发实例大全》——1.4 使用CSS修饰HTML 5页面
- 10-04 《HTML5游戏编程核心技术与实战》——2.8 小结
- 10-04 腾讯视频生成的Html代码
- 10-04 ie下tbody的innerhtml属性只读
- 控制面板
- 友情链接
- 最近发表
-
- 涂鸦而不乱简约艺术主题Office PPT免费模板背景素材下载
- 有创意的情人表白动态贺卡Office PPT免费模板背景素材下载
- 绿色简约技能竞赛电力Office PPT免费模板背景素材下载
- 极简几何商务蓝年终总结汇报Office PPT免费模板背景素材下载
- 蓝橙简约商务年终总结汇报Office PPT免费模板背景素材下载
- 绿色清新教育风课堂教学通用Office PPT免费模板背景素材下载
- 潮流复古艺术感年终总结Office PPT免费模板背景素材下载
- 浅绿商务风工作总结报告Office PPT免费模板背景素材下载
- 大气简约时尚年终总结汇报Office PPT免费模板背景素材下载
- 喜庆春节风公司年终誓师表彰大会Office PPT免费模板背景素材下载
- 最新留言
-