Created
October 20, 2020 19:56
-
-
Save mcallegari10/f961e83b12cf5f82bc06f6c3b060f17f to your computer and use it in GitHub Desktop.
Particles Geometry
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
const particlesGeometry = new THREE.BufferGeometry() | |
const particlesVertices = [] | |
const particlesRandoms = [] | |
const flyingParticles = 150 | |
let isPlaying = false | |
let animFrame = null | |
const offscreenLimit = 100 | |
const particleAcceleration = 0.002 | |
const minParticlePosition = -100 | |
const maxParticlePosition = 100 | |
for (let i = 0; i < flyingParticles; i++) { | |
particlesVertices.push(0, 0, getRandomFloat(-20, -10)) | |
particlesRandoms.push( | |
getRandomFloat(minParticlePosition, maxParticlePosition), | |
getRandomFloat(minParticlePosition, maxParticlePosition), | |
getRandomFloat(minParticlePosition, maxParticlePosition) | |
) | |
} | |
particlesGeometry.addAttribute('position', new THREE.Float32BufferAttribute(particlesVertices, 3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment