Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jcponce committed Oct 11, 2024
1 parent ca6749e commit 2aebe43
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions threejs/dodecahedron-fractal/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -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({
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2aebe43

Please sign in to comment.