Fork: Archimedean Spiral v004
Log in to post a comment.
// Forked from "Fork: Archimedean Spiral" by rupertxrussell
// https://turtletoy.net/turtle/4355b2cb94
// Forked from "Archimedean Spiral" by Samolevsky
// https://turtletoy.net/turtle/2903b6cc46
// You can find the Turtle API reference here: https://turtletoy.net/syntax
// Set the pen opacity to 1
Canvas.setpenopacity(1);
// Global code will be evaluated once.
const turtle = new Turtle();
// User-defined parameters
const numberOfLoops = 20; // min=10 max=100 step=1 Number of loops in the spiral
const incrementValue = 1.93; // min=1 max=10 step=0.01 Increment factor determining the spiral shape
const fineIV = -0.882; // min=-1 max=1 step=0.001 fine tine incrementValue
const sizeFactor = 0.19 ; // min=0.1 max=1 step=0.01 Size factor of the spiral
// Function to draw an Archimedean Spiral with user-defined parameters
function drawArchimedeanSpiral(loops, increment, spiralSize, xO, yO) {
turtle.penup();
turtle.goto(xO, yO);
turtle.pendown();
for (let angle = 0; angle < loops * 2 * Math.PI; angle += increment) {
const radius = angle * spiralSize;
const x = radius * Math.cos(angle);
const y = radius * Math.sin(angle);
turtle.goto(x + xO, y + yO);
}
}
drawArchimedeanSpiral(numberOfLoops, incrementValue+fineIV, sizeFactor, 0, 0,); //0
drawArchimedeanSpiral(numberOfLoops, incrementValue+fineIV, sizeFactor, 37.1, -17.1); //1
drawArchimedeanSpiral(numberOfLoops, incrementValue+fineIV, sizeFactor, 33.3, 24.2); //2
drawArchimedeanSpiral(numberOfLoops, incrementValue+fineIV, sizeFactor, -3.8, 41.2); //3
drawArchimedeanSpiral(numberOfLoops, incrementValue+fineIV, sizeFactor, -37.1, 17.1); //4
drawArchimedeanSpiral(numberOfLoops, incrementValue+fineIV, sizeFactor, -33.3, -24.2); //5
drawArchimedeanSpiral(numberOfLoops, incrementValue+fineIV, sizeFactor, 3.8, -41.2); //6