Javascript 如何在three.js中旋转粒子
我有一个粒子,它是一个图像。当我旋转粒子时,它会在后面留下一个圆。我怎样才能摆脱这个怪圈 小提琴在这里: 代码: -编辑 我测试了我的理论,这不是问题,不要浪费你的时间 只是一个猜测,但我认为这可能与您从另一个域加载texture.png有关。 尝试使用从运行代码的同一域加载的映像,看看这是否解决了问题 我认为问题可能与three.js无法访问纹理上的像素数据有关,因为存在交叉原点问题Javascript 如何在three.js中旋转粒子,javascript,three.js,Javascript,Three.js,我有一个粒子,它是一个图像。当我旋转粒子时,它会在后面留下一个圆。我怎样才能摆脱这个怪圈 小提琴在这里: 代码: -编辑 我测试了我的理论,这不是问题,不要浪费你的时间 只是一个猜测,但我认为这可能与您从另一个域加载texture.png有关。 尝试使用从运行代码的同一域加载的映像,看看这是否解决了问题 我认为问题可能与three.js无法访问纹理上的像素数据有关,因为存在交叉原点问题 var camera, scene, renderer, material, img, texture, pa
var camera, scene, renderer, material, img, texture, particle;
init();
animate();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.z = 1000;
scene.add(camera);
img = new Image();
texture = new THREE.Texture(img);
img.onload = function() {
texture.needsUpdate = true;
makeParticle();
};
img.src = "http://www.atalasoft.com/cs/blogs/davidcilley/files/PNG_Mask.png";
renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
}
function makeParticle() {
material = new THREE.ParticleBasicMaterial({
map: texture,
blending: THREE.AdditiveBlending,
});
// make the particle
particle = new THREE.Particle(material);
particle.scale.x = particle.scale.y = 1;
particle.position.x = 10;
scene.add(particle);
}
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
particle.rotation.z += 0.01
}