Draw the Archimedean Spiral with user-defined parameters
Spiral:
Archimedean Spiral (variation)
Triangle:
Archimedean Spiral (variation)
Square:
Archimedean Spiral (variation)
Pentagon:
Archimedean Spiral (variation)
Hexagon:
Archimedean Spiral (variation)
Polygon:
Archimedean Spiral (variation)
Star:
Archimedean Spiral (variation)
Shell:
Archimedean Spiral (variation)
My first Turtle 😃
Log in to post a comment.
// 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); // User-defined parameters const numberOfLoops = 44; // min=1 max=100 step=1 Number of loops in the spiral const incrementValue = 2.09; // min=0.1 max=10 step=0.01 Increment factor determining the spiral shape const fineIV = 0; // min=-1 max=1 step=0.001 fine tine incrementValue const sizeFactor = 0.4 ; // min=0.1 max=5 step=0.01 Size factor of the spiral const xOffset = 1; // min=-50 max=50 step=1 Offset center const yOffset = -17; // min=-50 max=50 step=1 Offset center // Global code will be evaluated once. const turtle = new Turtle(); turtle.penup(); turtle.goto(xOffset, yOffset); turtle.pendown(); // Function to draw an Archimedean Spiral with user-defined parameters function drawArchimedeanSpiral(loops, increment, spiralSize) { 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 + xOffset, y + yOffset); } } // Draw the Archimedean Spiral with user-defined parameters drawArchimedeanSpiral(numberOfLoops, incrementValue+fineIV, sizeFactor);