canvas随机噪点动画代码
代码语言:html
所属分类:动画
代码描述:canvas随机噪点动画代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
background-color: #000;
margin: 0;
overflow: hidden;
background-repeat: no-repeat;
}
canvas {
position: absolute;
}
</style>
</head>
<body translate="no">
<canvas id="canvas" width="200" height="300"></canvas>
<script>
let canvas = document.getElementById("canvas");
let dimensionx = window.innerWidth;
let dimensiony = window.innerHeight;
let mousePos = { x: 0.5, y: 0.5 };
let runTime = 0,
prevT = performance.now();
canvas.width = dimensionx;
canvas.height = dimensiony;
canvas.style.left = (window.innerWidth - dimensionx) / 2 + "px";
canvas.style.top = (window.innerHeight - dimensiony) / 2 + "px";
let gl = canvas.getContext("webgl2");
const m2PI = Math.PI * 2;
//************** Shad.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0