Thing 001
Log in to post a comment.
// by rupertxrussell Canvas.setpenopacity(1); // Global code will be evaluated once. const turtle = [] const count = 4; //min=2, max=5, step=1 const s = 200; ///min=1, max=200, step=1 // const r = 11 //min=1, max=100, step=1 const radius=22; //min=10 max=100 step=1 const n = 69; //min=10 max=69 step=1 const fineN = 0; ///min=-5 max=5 step=0.01 const m = 10; ///min=10 max=455 step=1 const fineM = 0; ///min=-10 max=10 step=1 var xOffset = 0; var yOffset = 0; // create multiple turtles and space them out in a grid for (let n=0; n<count; n++) { turtle[n] = new Turtle(); } for (var i = 0; i < n + fineN; i++) { turtle[1].penup(); turtle[2].penup(); connectPoints(radius, i, i * m + fineM); } function connectPoints(r, firstPoint, secondPoint) { // Connect two points on a circle var step = 2 * Math.PI/n; for (let x=0; x<count; x++) { for (let y=0; y<count; y++) { xOffset = (x + .5) * s/count - s/2; yOffset = (y + .5) * s/count - s/2; // draw n points on circle const x1 = xOffset + r * Math.cos(firstPoint * step); const y1 = yOffset - r * Math.sin(firstPoint * step); const x2 = xOffset + r * Math.cos(secondPoint * step); const y2 = yOffset -r * Math.sin(secondPoint * step); turtle[1].jump(x1, y1); turtle[2].goto(x2, y2); turtle[1].pendown(); turtle[2].pendown(); } } }