Moiré effect 🗑️

A simple yet effective demonstration of how the en.wikipedia.org/wiki/moir%c3%a9_pattern works. #illusion

Moiré effect 🗑️ (variation)

Log in to post a comment.

const delta = 26.6; //min=0 max=50 step=.1
const grid = .4; //min=.15 max=10 step=.05

// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(.8);

// Global code will be evaluated once.
const turtle = new Turtle();

// The walk function will be called until it returns false.
function walk(i) {
    zebraCircle(i * .15, delta, grid);
    zebraCircle(i * .15, -delta, grid);
    return i * .15 < 200;
}

function zebraCircle(r, delta = 0, grid) {
    if(r < grid/2 || (((r - grid/2) / grid) | 0) % 2 == 1) {
        turtle.jump(delta, -r)
        turtle.circle(r);
    }
}