canvas网状波纹波浪动画效果代码
代码语言:html
所属分类:动画
代码描述:canvas网状波纹波浪动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!doctype html> <html> <head> <meta charset="utf-8"> <style> * { margin: 0; padding: 0; } canvas { display: block; } </style> </head> <body> <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 = pixels[i]; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0