1.1.8 • Published 8 months ago
three-particle-geometry v1.1.8
three-particle-geometry
An npm package that allows users to represent threeJS geometry instances as a system of customizable particles. Feel free to clone and use the demo.
Prerequisites
- Have threeJS installed in your project.
- Have a threeJS scene set up that is runnable on the browser.
Installation
npm install three-particle-geometry
Code Snippets
Import the Library into your file.
import { ParticleGeometry } from 'three-particle-geometry';
- Define the geometry that you want to represent as particles. This can be any threeJS geometry instance.
- Define the geometry and material you want to assign to each of the particles.
- Call the ParticleGeometry constructor and add the particles to the scene.
// 1. The geometry instance to be represented as particles
const boxGeometry = new THREE.BoxGeometry(1, 1, 1);
// 2.
// The geometry instance to be used for each of the particles
const particleGeometry = new THREE.SphereGeometry(0.005);
// The material to be used for each of the particles
const particleMaterial = new THREE.MeshBasicMaterial({
color: "yellow",
});
// 3. Call to the ParticleGeometry constructor and add to the scene
const particles = new ParticleGeometry(boxGeometry, particleGeometry, particleMaterial, { numParticles: 20000 });
scene.add(particles);
1.1.8
8 months ago
1.1.7
8 months ago
1.1.6
8 months ago
1.1.5
8 months ago
1.1.4
8 months ago
1.1.3
8 months ago
1.1.2
8 months ago
1.1.1
8 months ago
1.1.0
8 months ago
1.0.9
8 months ago
1.0.8
8 months ago
1.0.7
8 months ago
1.0.6
8 months ago
1.0.5
8 months ago
1.0.4
8 months ago
1.0.3
8 months ago
1.0.2
8 months ago
1.0.1
8 months ago
1.0.0
8 months ago