From 54a9d8495ab364ceeb4e17d886f7a9500c43e67f Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 9 Sep 2023 09:18:39 +1200 Subject: [PATCH] play --- Catalogue/Spiral Accident2/script.js | 2 +- Catalogue/nodal.html | 3 ++- docs/js/helper.js | 2 +- docs/js/objects.js | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Catalogue/Spiral Accident2/script.js b/Catalogue/Spiral Accident2/script.js index 61614c6..a80aba5 100644 --- a/Catalogue/Spiral Accident2/script.js +++ b/Catalogue/Spiral Accident2/script.js @@ -56,7 +56,7 @@ function drawSpiral(angle) { ctx.moveTo(cX, cY); const nColor = lerpRGB(startColor, endColor, Math.cos(rad(n / 2))); - const nAngle = n * angle + Math.sin(angle * (n - angle * 100) * 3); + const nAngle = n * angle + Math.sin(angle * (n - angle * 100) * 2); const radius = distanceMultiplier * n; const xCoord = radius * Math.cos(nAngle) + centerX; const yCoord = radius * Math.sin(nAngle) + centerY; diff --git a/Catalogue/nodal.html b/Catalogue/nodal.html index 93d888a..8828352 100644 --- a/Catalogue/nodal.html +++ b/Catalogue/nodal.html @@ -31,7 +31,7 @@ render(); render_clear(); - Draw_nodal(300, 100, 31, rotation, "blue"); + Draw_nodal(300, 13, 4, rotation, "#FFD700"); // Draw_center(); //Debugging @@ -65,6 +65,7 @@ ctx.lineTo(centerX + (Math.cos(rad(angle * z + rotate)) * radius), centerY + (Math.sin(rad(angle * z + rotate)) * radius)); } ctx.strokeStyle = colour; + ctx.lineWidth = 8 ctx.stroke(); } diff --git a/docs/js/helper.js b/docs/js/helper.js index a448f66..646fbee 100644 --- a/docs/js/helper.js +++ b/docs/js/helper.js @@ -46,7 +46,7 @@ async function fetchConfig(className) { Phyllotaxis: [ { type: "range", min: 1, max: 40, defaultValue: 24, property: "width" }, { type: "range", min: 0, max: 3141, defaultValue: 0, property: "start" }, - { type: "range", min: 1, max: 1000, defaultValue: 300, property: "nMax" }, + { type: "range", min: 1, max: 10000, defaultValue: 300, property: "nMax" }, { type: "range", min: 0, max: 2, defaultValue: 0, property: "wave" }, { type: "color", defaultValue: "#2D81FC", property: "colour1" }, { type: "color", defaultValue: "#FC0362", property: "colour2" }, diff --git a/docs/js/objects.js b/docs/js/objects.js index bf3c3ac..e73b638 100644 --- a/docs/js/objects.js +++ b/docs/js/objects.js @@ -270,6 +270,7 @@ class Phyllotaxis extends BaseShape { const distanceMultiplier = 2; const maxIterations = 1000; + for (let n = 0; n < maxIterations; n++) { const nColor = lerpRGB(startColor, endColor, Math.cos(rad(n / 2))); @@ -289,6 +290,7 @@ class Phyllotaxis extends BaseShape { draw(rotation) { rotation *= (this.speedMultiplier / 300) rotation += this.start + const sizeMultiplier = this.nMax/(5-3) if (this.wave === 1) { this.drawWave(rotation) } @@ -305,7 +307,7 @@ class Phyllotaxis extends BaseShape { const y = r * Math.sin(a) + centerY; ctx.beginPath(); - ctx.arc(x, y, 8, 0, 2 * Math.PI); + ctx.arc(x, y, (n/sizeMultiplier)+3, 0, 2 * Math.PI); ctx.fillStyle = ncolour; // ctx.fillStyle = colourToText(ncolour); ctx.fill();