Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async (three, { scene, camera }) => {
const system = await ParticleSystem.fromJSONAsync(
json.particleSystemState,
three,
{ shouldAutoEmit: false }
);
system.addRenderer(new SpriteRenderer(scene, three)).emit({
onStart: () => feedbackRef.component.setState({ hasStarted: true }),
onUpdate: () => feedbackRef.component.setState({ isUpdating: true }),
onEnd: () =>
feedbackRef.component.setState({ hasEnded: true, isUpdating: false }),
});
return system;
};
export default async (three, { scene, camera }) => {
THREE = three;
GLTFLoader = await import('three-gltf-loader');
const system = new ParticleSystem();
const mesh = await loadMeshFromGLTF();
const emitter = await createEmitter(mesh);
mesh.material.wireframe = true;
scene.add(mesh);
return system
.addEmitter(emitter)
.addRenderer(new SpriteRenderer(scene, THREE));
};
export default async (three, { scene, camera }) => {
THREE = three;
const system = new ParticleSystem();
const color1 = new THREE.Color();
const color2 = new THREE.Color();
const emitter = createEmitter(color1, color2);
animate({ color1, color2, emitter, camera, scene });
return system
.addEmitter(emitter)
.addRenderer(new SpriteRenderer(scene, THREE));
};
export default async (three, { scene, camera, renderer }) => {
THREE = three;
const system = new ParticleSystem();
scene.add(createPlane());
return system
.addEmitter(createEmitter(camera, renderer))
.addRenderer(new SpriteRenderer(scene, THREE));
};
export default async (three, { scene, camera }) => {
THREE = three;
const system = new ParticleSystem();
camera.position.z = 500;
return system
.addEmitter(createEmitter())
.addRenderer(new SpriteRenderer(scene, THREE));
};
camera,
renderer,
});
const emitterB = createEmitter({
colorA: '#004CFE',
colorB: '#6600FF',
camera,
renderer,
});
animateEmitters(emitterA, emitterB);
return system
.addEmitter(emitterA)
.addEmitter(emitterB)
.addRenderer(new SpriteRenderer(scene, THREE));
};