当前位置:   article > 正文

【HTML——3d粒子特效(效果+代码)】_html 3d粒子

html 3d粒子

index.js

var width, height;

var canvas = document.querySelector(‘canvas’);

canvas.width = width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);

canvas.height = height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);

var ctx = canvas.getContext(‘2d’);

ctx.translate(canvas.width / 2, canvas.height / 2);

var points = [];

var depth = 8;

var scale = 70;

for (var x = -depth/2; x <= depth/2; x++) {

for (var y = -depth/2; y <= depth/2; y++) {

for (var z = -depth/2; z <= depth/2; z++) {

points.push([x * scale, y * scale, z * scale]);

}

}

}

var minDistance = 1000;

var maxDistance = 2000;

var f = 500;

var rot = 0;

var direction = -1;

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/865060
推荐阅读
相关标签
  

闽ICP备14008679号