Encoding for love poem. Variation from Maurer Rose (Credit: turtletoy.net/user/rupertxrussell)
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);
//Global code will be evaluated once.
const turtle = new Turtle();
// turtle.penup();
// turtle.goto(-50,-20);
// turtle.pendown();
// // The walk function will be called until it returns false.
// function walk(i) {
// turtle.forward(100);
// turtle.right(144);
// return i < 4;
// }
const n = 170; ; // min=1 max=777 step=1 // The 'n' value in the rose equation, controls the number of petals
const fine_n = 7; // min=0 max = 10 step=1;
const d = 70; ; // min=1 max=666 step=1 // The 'd' value, controls the density of the connecting lines
const fine_d = 7; // min=-10 max = 10 step=1;
// Define the size of the rose
const size = 127; ; // min=0 max=1000 step=1
// Function to draw a point
function drawPoint(angle) {
const k = angle * (d + fine_d) * Math.PI / 300;
const r = size * Math.sin((n + fine_n) * k);
const x = r * Math.cos(k);
const y = r * Math.sin(k);
if (angle === 0) {
turtle.jump(x, y);
} else {
turtle.goto(x, y);
}
}
// Draw the Maurer Rose
for (let i = 0; i <= 360; i++) {
drawPoint(i);
}
// Return whether to animate (false for static images)
function loop() {
return false;
}