Flock
This was generated using Google Gemini.
Log in to post a comment.
Canvas.setpenopacity(-1);
// User-adjustable sliders using Turtletoy inline syntax
let Layers = 3; // min=1, max=6, step=1
let RaysPerLayer = 70; // min=20, max=150, step=5
let Twist = 0.4; // min=0.1, max=2.0, step=0.1
let Scale = 1.0; // min=0.5, max=2.0, step=0.1
let Waviness = 0.3; // min=0.05, max=1.0, step=0.05
const turtle = new Turtle();
const totalSteps = Layers * RaysPerLayer;
function walk(i) {
if (i >= totalSteps) return false;
const layer = Math.floor(i / RaysPerLayer);
const ray = i % RaysPerLayer;
const layerOffsets = [
[-25 * Scale, 15 * Scale],
[25 * Scale, 15 * Scale],
[0, -25 * Scale],
[-15 * Scale, -20 * Scale],
[15 * Scale, -20 * Scale],
[0, 25 * Scale]
];
const offsetIndex = layer % layerOffsets.length;
const cx = layerOffsets[offsetIndex][0];
const cy = layerOffsets[offsetIndex][1];
const angle = (ray / RaysPerLayer) * Math.PI * 2 + (layer * Twist);
const innerRadius = (5 + Math.sin(ray * Waviness) * 10) * Scale;
const outerRadius = (65 + Math.cos(ray * (Waviness * 0.67)) * 25) * Scale;
turtle.penup();
turtle.goto(cx + Math.cos(angle) * innerRadius, cy + Math.sin(angle) * innerRadius);
turtle.pendown();
const curveOffset = angle + 0.9 + (layer * (Twist * 0.625));
const targetX = cx + Math.cos(curveOffset) * outerRadius;
const targetY = cy + Math.sin(curveOffset) * outerRadius;
turtle.goto(targetX, targetY);
return true;
}