Moire art- superposed grids.

A variation....

Moire patterns result when you superpose two regular grid patterns at a slight angle. Examples on my website. What I do here is instead use a grid above a black and white image. I start with a black and white image, and generate its 'negative' inversion. Bold b&w images work well- or large bold text. You can do that in LB or your preferred painting app.

Now I create a new image by selecting alternately vertical stripes from each.

The underlying image has been 'scrambled' and is very difficult to see.

Npw you can superpose the selection grid. You can use black, white or the original colour. The image magically re-appears- as original or as the inversion.


LB source code.

Various variations of code have been used.

    nomainwin

    WindowWidth  = 990
    WindowHeight = 660

    graphicbox #w.g1,   2,   2, 300, 300  '   B&W
    graphicbox #w.g2, 308,   2, 300, 300  '   W&B
    graphicbox #w.g3, 678,   2, 300, 300  '   Alternating vertical stripes...
    graphicbox #w.g4, 626,   2,  30, 300  '    .. assembled from sampled stripes.
    graphicbox #w.g5,   2, 306, 300, 300
    graphicbox #w.g6, 308, 306, 300, 300
    graphicbox #w.g7, 678, 306, 300, 300

    open "Moire Art" for window as #w

    #w "trapclose quit"

    loadbmp "scr1", "tiger2.bmp"
    #w.g1 "down ; drawbmp scr1 1 1"

    loadbmp "scr2", "tiger2inv.bmp"
    #w.g2 "down ; drawbmp scr2 1 1"
    #w.g3 "down ; drawbmp scr2 1 1"
    #w.g4 "down ; fill cyan"
    #w.g3 "backcolor darkblue"
    #w.g7 "down ; backcolor black"


    S =10

    for i =0 to 300 step S
        #w.g1 "getbmp  scr3 "; i;    " 1 "; S /2; " 300"
        #w.g4 "drawbmp scr3 10 1"
        #w.g3 "drawbmp scr3 "; i; " 1"
        #w.g3 "flush"
        scan
    next i

    for i =0 to 500 step S                      '   create black grid
        #w.g7 "up ; goto "; i;       " 1"
        #w.g7 "down ; boxfilled "; i +S /2; " 300"
    next i

    #w.g3 "getbmp scr4 1 1 300 300"

    #w.g5 "down ; backcolor red ; color red"
    #w.g5 "drawbmp scr4 1 1"
    for i =0 to 500 step S
        #w.g5 "up ; goto "; i +S /2; " 1"
        #w.g5 "down ; boxfilled "; i +S;    " 300"
    next i

    #w.g6 "down ; backcolor blue ; color blue"  '   use blue grid
    #w.g6 "drawbmp scr4 1 1"
    for i =0 to 500 step S
        #w.g6 "up ; goto "; i ; " 1"
        #w.g6 "down ; boxfilled "; i +S /2;    " 300"
    next i

    wait

    sub quit h$
        close #w
        end
    end sub