Turtle Studio

// Start with a square using forward and right for (let i = 0; i < 4; i++) { forward(50); right(90); } // Move to another position penUp(); goto(100, 100); penDown(); // Draw a triangle using backward and left for (let i = 0; i < 3; i++) { backward(70); left(120); } // Test hide/show with a circle-like pattern penUp(); goto(-100, 100); penDown(); hide(); // Hide the turtle while drawing for (let i = 0; i < 36; i++) { forward(10); left(10); } show(); // Show the turtle again // Draw a rainbow pattern const colors = ['#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#0000FF', '#4B0082', '#9400D3']; // Final burst pattern with color changes penUp(); goto(150, -100); penDown(); setHeading(0); for (let i = 0; i < 18; i++) { penColor(colors[i % colors.length]); forward(80); backward(80); right(20); }