Created
December 14, 2014 12:14
-
-
Save chanpu/f9b40bfc6484f238639e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// パーティクルの数 | |
particleCount = 5000; | |
particles = new THREE.Geometry(); | |
// テクスチャの設定 | |
texture = THREE.ImageUtils.loadTexture("images/particles.png") | |
// マテリアルの設定 | |
material = new THREE.PointCloudMaterial({ | |
color: 0xFFFFFF, | |
size: 5, | |
map: texture, | |
transparent: true | |
}); | |
// パーティクルの位置の設定 | |
for (var i = 0; i < particleCount; i++) { | |
var px = Math.random() * 1000 - 500, | |
py = Math.random() * 1000 - 500, | |
pz = Math.random() * 1000 - 500; | |
particle = new THREE.Vector3( px, py, pz); | |
// パーティクルのべロシティの設定 | |
particle.velocity = new THREE.Vector3( 0, -Math.random(), 0 ); | |
particles.vertices.push( particle ); | |
} | |
pointCloud = new THREE.PointCloud( particles, material ); | |
// パーティクルの深さを毎フレームソート | |
pointCloud.sortParticles = true; | |
scene.add( pointCloud ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment