线条激光效果

代码语言:html

所属分类:动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<title> pink lasers</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://repo.bfw.wiki/bfwrepo/css/normalize.min.css">
<style>
      html, body, canvas {
  width: 100%;
  height: 100%;
  overflow: hidden;
  content-zooming: none;
}

    </style>

</head>
<body translate="no">
<canvas></canvas>

<script>
      let af;
const numLasers = 250;
const tail = 200;
const canvas = document.querySelector("canvas");
const ctx = canvas.getContext("2d");
const createLasers = n => {
  const lasers = [];
  for (let i = 0; i < n; ++i) {
    lasers.push({
      x: Math.random() * canvas.width,
      y: Math.random() * canvas.height,
      s: Math.random() * 2 + 1 });

  }
  return lasers;
}.........完整代码请登录后点击上方下载按钮下载查看

网友评论0