js实现canvas网格波浪波纹动画效果代码

代码语言:html

所属分类:动画

代码描述:js实现canvas网格波浪波纹动画效果代码

代码标签: 网格 波浪 波纹 动画 效果

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

<html lang="en"><head>

  <meta charset="UTF-8">
  

  
  
  
<style>
* {margin: 0; padding: 0;}

canvas {display: block;}
</style>



</head>

<body>
  <canvas width="1292" height="744"><canvas>


  
      <script >
var canvas = document.body.querySelector('canvas'),
ctx = canvas.getContext('2d'),
W = canvas.width = window.innerWidth,
H = canvas.height = window.innerHeight,
pixels = [];

for (var x = -400; x < 400; x += 5) {
  for (var z = -250; z < 250; z += 5) {
    pixels.push({ x: x, y: 100, z: z });
  }
}

function render(ts) {
  var imageData = ctx.getImageData(0, 0, W, H),
  len = pixels.length,
  fov = 250,
  pixel,scale,
  x2d,y2d,c;

  for (var i = 0; i < len; i++) {
    pixel .........完整代码请登录后点击上方下载按钮下载查看

网友评论0