<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>canvas霓虹灯-光晕</title>
<style>
html{height: 100%;overflow: hidden;}
body{height: 100%;margin: 0;}
#test{
background: #000;
}
</style>
</head>
<body>
<canvas id="test"></canvas>
<script>
const cvs=document.getElementById('test');
cvs.width=window.innerWidth;
cvs.height=window.innerHeight;
const ctx=cvs.getContext('2d');
//颜色数组
const colors=['red','yellow'];
function draw(){
//保存上下文对象的状态
ctx.save();
//偏移坐标系
ctx.translate(300,400);
//开始绘制路径
ctx.beginPath();
//向路径集合中添
canvas绘制霓虹灯-带光晕
最新推荐文章于 2024-06-12 10:25:35 发布