Contrast illusion

Try this code out, it demonstrates a famous colours contrast illusion: the rectangles look different colours but they are actually the same:


function setup()
    parameter.number("dist",0,WIDTH/6,WIDTH/6)
    parameter.integer("bg",0,10)
    black=color(0)
    white=color(255)
end

function draw()
    noSmooth()
    background(black:mix(white,bg/10))
    fill(white:mix(black,bg/10))
    rect(WIDTH/2,0,WIDTH/2,HEIGHT)
    fill(127.5)
    rect(WIDTH/6*2-dist,HEIGHT/3,WIDTH/6,HEIGHT/3)
    rect(WIDTH/6*3+dist,HEIGHT/3,WIDTH/6,HEIGHT/3)
end