Fork: Fibonacci Sequence v002

Fibonacci Sequence
// Released under the MIT licence
// mit-license.org/
// you can use this for commercial gain if you like eg you can sell artworks with this image.

Log in to post a comment.

// Forked from "Fibonacci Sequence" by rupertxrussell
// https://turtletoy.net/turtle/29087990aa

// You can find the Turtle API reference here: https://turtletoy.net/syntax
// Released under the MIT licence 
// https://mit-license.org/
// you can use this for commercial gain if you like eg you can sell artworks with this image.
// https://turtletoy.net/turtle/29087990aa
// https://turtletoy.net/user/rupertxrussell

// https://en.wikipedia.org/wiki/Fibonacci_sequence
// A tiling with squares whose side lengths are successive Fibonacci numbers: 1, 1, 2, 3, 5, 8, 13 and 21
// https://en.wikipedia.org/wiki/Fibonacci_sequence#/media/File:Fibonacci_Squares.svg

Canvas.setpenopacity(1);

// Global code will be evaluated once.
const turtle = new Turtle();
const scale = 2; //min=1 max=10 step=0.1
const outline = 0; //min=0 max=1 step=1 (No, Yes)
const xOffset = -4.5; //min=-100 max=100 step=0.5
const yOffset = -20 ; //min=-100 max=100 step=0.5

turtle.penup();
turtle.goto(xOffset * scale, yOffset * scale);
turtle.pendown();
   
sqRight(1);
sqRight(1);
sqRight(2);
sqRight(3);
sqRight(5);
sqRight(8);
sqRight(13);
sqRight(21);
sqRight(34);
sqRight(55);


function sqRight(n){
   turtle.circle(n * scale, extent = -90);
 
 if(outline == 1){
    for (var i = 0; i < 4; i++) {
        turtle.forward(n * scale);
        turtle.right(90);
    }
  }
}