String art 🧵

90 nails / max 5 windings per nail

Log in to post a comment.

const turtle = new Turtle();
const string = [40, 14, 60, 26, 69, 27, 65, 28, 67, 24, 63, 28, 71, 23, 70, 26, 66, 29, 65, 19, 71, 22, 68, 25, 73, 29, 68, 27, 64, 22, 74, 18, 70, 24, 61, 19, 69, 25, 65, 12, 58, 79, 54, 80, 55, 78, 56, 76, 32, 68, 30, 67, 23, 73, 19, 66, 24, 72, 17, 71, 21, 69, 29, 71, 27, 62, 26, 64, 23, 75, 19, 76, 31, 75, 57, 24, 60, 13, 67, 20, 62, 22, 65, 18, 63, 25, 59, 26, 61, 23, 66, 28, 72, 21, 74, 30, 5, 56, 79, 53, 81, 55, 88, 24, 64, 11, 36, 13, 59, 78, 61, 27, 70, 33, 77, 60, 79, 45, 18, 71, 34, 8, 32, 75, 55, 72, 22, 70, 53, 80, 57, 2, 27, 3, 58, 25, 66, 21, 49, 66, 12, 38, 78, 58, 75, 39, 15, 41, 77, 57, 11, 37, 13, 34, 70, 28, 4, 59, 79, 47, 68, 15, 61, 7, 33, 14, 59, 76, 33, 69, 51, 79, 62, 9, 31, 73, 55, 89, 25, 61, 80, 56, 74, 31, 6, 57, 1, 26, 68, 85, 65, 47, 20, 44, 17, 42, 76, 55, 87, 67, 29, 10, 64, 81, 63, 23, 69, 15, 40, 18, 43, 4, 56, 73, 54, 82, 63, 9, 35, 16, 43, 67, 50, 22, 51, 72, 35, 12, 59, 77, 31, 11, 33, 9, 36, 75, 30, 72, 52, 74, 57, 0, 73, 37, 78, 60, 5, 29, 74, 38, 15, 32, 14, 34, 77, 58, 76, 30, 4, 58, 11, 35, 17, 64, 83, 63, 80, 62, 81, 56, 77, 54, 78, 44, 62, 8, 33, 10, 31, 13, 39, 19, 46, 21, 48, 20, 42, 15, 37, 20, 41, 21, 45, 20, 46, 18, 36, 10, 60, 80, 52, 81, 54, 86, 28, 3, 30, 7, 32, 13, 35, 14, 37, 12, 32, 11, 34, 16, 42, 3, 41, 17, 36, 16, 37, 10, 34, 12, 36, 14, 38, 17, 39, 16, 38, 0, 39, 1, 40, 16, 41, 2, 53, 83, 54, 85, 44, 5, 43, 84, 53, 82, 52, 10, 35, 8, 47, 87, 53, 85, 51, 81, 49, 0, 46, 7, 47, 88, 48, 82, 9, 51, 83, 50, 9, 52, 84, 50, 89, 38, 88, 44, 6, 45, 86, 46, 6, 52, 83, 43, 3, 51, 82, 40, 2, 42, 4, 44, 84, 42, 82, 49, 8, 46, 87, 50, 1, 47, 83, 49, 7, 45, 5, 39, 89, 48, 8, 45, 84, 41, 1, 49, 88, 50, 0, 40, 7, 48, 86, 43, 6, 48, 2];
const radius = 75; // min=25, max=200, step=5
function walk(i, t) {
    const angle = (string[i] / 90) * Math.PI*2 + Math.PI/2;
    const pos = [Math.sin(angle) * radius, Math.cos(angle) * radius];
    if (i === 0) turtle.jump(pos);
    else turtle.goto(pos);
    return i < string.length * t;
}