Eyes on a string

doingg

Log in to post a comment.

// Global code will be evaluated once.
const turtle = new Turtle()
turtle.penup()
turtle.goto(-100,-100)
turtle.pendown()

var prevLine = 0

// The walk function will be called until it returns false.
function walk(i) {
    var line = Math.floor(i / (Math.PI * 100 * 14))
    if (line != prevLine) {
        turtle.penup()
        turtle.goto(-100, -100 + line * 25)
        turtle.setheading(0)
        prevLine = line
        turtle.pendown()
    }
    turtle.forward(1)
    turtle.right(Math.sin(i/100) * 90)
    return line < 9
}