From 2aebe43192a52d6c7fadca403ec2abcc35290a73 Mon Sep 17 00:00:00 2001 From: Juan Carlos Ponce Campuzano <37394697+jcponce@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:32:38 +1000 Subject: [PATCH] Update script.js --- threejs/dodecahedron-fractal/script.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/threejs/dodecahedron-fractal/script.js b/threejs/dodecahedron-fractal/script.js index 1c86ce8e..846540d5 100644 --- a/threejs/dodecahedron-fractal/script.js +++ b/threejs/dodecahedron-fractal/script.js @@ -10,13 +10,13 @@ let scene, camera, renderer, composer, fractalLine; let n = 1; let increasing = true; const maxN = 25; -const speed = 0.03; // Adjust this value to control the speed of n's change +const speed = 0.01; // Adjust this value to control the speed of n's change let fireEffect; +let controls; init(); animate(); - function init() { // Scene setup scene = new THREE.Scene(); @@ -28,8 +28,10 @@ function init() { document.body.appendChild(renderer.domElement); // Controls - const controls = new OrbitControls(camera, renderer.domElement); + controls = new OrbitControls(camera, renderer.domElement); controls.enableDamping = true; + //controls.autoRotate = true; + //controls.autoRotateSpeed = - 0.5; // Dodecahedron Geometry const geometry = new THREE.DodecahedronGeometry(1); @@ -39,6 +41,7 @@ function init() { const edges = new THREE.EdgesGeometry(geometry); const line = new THREE.LineSegments(edges, lineMaterial); + line.position.y = -0.5; scene.add(line); fireEffect = getParticleSystem({ @@ -67,6 +70,8 @@ function init() { function animate() { requestAnimationFrame(animate); + //controls.update(); + // Rotate the icosahedron scene.children[0].rotation.y += 0.001; scene.children[0].rotation.x -= 0.002;