第一次使用three.js,我正在做一个非常简单的粒子动画,其中我正在映射4种不同的纹理.到目前为止,一切都按预期工作,除了我无法弄清楚如何旋转粒子,使它们以随机方向呈现(颠倒,侧身等).任何帮助将不胜感激!
到目前为止,您可以在此处查看我的进展:http://development.shapes.divshot.io/particles.html
以下是相关代码:
sprite1 = THREE.ImageUtils.loadTexture( "sprite1.png" );
sprite2 = THREE.ImageUtils.loadTexture( "sprite2.png" );
sprite3 = THREE.ImageUtils.loadTexture( "sprite3.png" );
sprite4 = THREE.ImageUtils.loadTexture( "sprite4.png" );
parameters = [ sprite1, sprite2, sprite3, sprite4];
for ( i = 0; i < parameters.length; i ++ ) {
sprite = parameters[i];
materials[i] = new THREE.PointCloudMaterial( { size: 45, map: sprite, depthTest: false, transparent : true} );
particles = new THREE.PointCloud( geometry, materials[i] );
particles.rotation.x = Math.random() * 60;
particles.rotation.y = Math.random() * 60; …
Run Code Online (Sandbox Code Playgroud)