From b6f6998c461d22c381fef7ff98296e8b9760d77a Mon Sep 17 00:00:00 2001 From: Juan Carlos Ponce Campuzano <37394697+jcponce@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:50:05 +1000 Subject: [PATCH] Update main.js --- threejs/particle-life/main.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/threejs/particle-life/main.js b/threejs/particle-life/main.js index f4637b7b..0518ad42 100644 --- a/threejs/particle-life/main.js +++ b/threejs/particle-life/main.js @@ -86,6 +86,13 @@ function init() { } +function toggleBlending(value) { + if (material) { + material.blending = value ? THREE.AdditiveBlending : THREE.NormalBlending; + material.needsUpdate = true; + } +} + function onMouseDown() { if (!firstClick) { setParameters(); @@ -230,12 +237,7 @@ function updateParticles() { geometry.attributes.position.needsUpdate = true; } -function toggleBlending(value) { - if (material) { - material.blending = value ? THREE.AdditiveBlending : THREE.NormalBlending; - material.needsUpdate = true; - } -} + init(); animate();