Here’s a program I wrote probably 25 years ago. I thought I’d dig it up and see if anyone remembers magic eyes. Probably the youngsters don’t know what I’m talking about. It takes a few seconds for the image to show. If you don’t know how to view what’s in the image, do a search on autostereograms and look at Wikipedia.
supportedOrientations(LANDSCAPE_ANY)
function setup()
img=image(WIDTH,HEIGHT)
tab={
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000011111111111111111000000000000000000000000000000000",
"00000000000000000000000000000000000012222222222222221000000000000000000000000000000000",
"00000000000000000000000000000000000012333333333333321000000000000000000000000000000000",
"00000000000000000000000000000000000012344444444444321000000000000000000000000000000000",
"00000000000000000000000000000000000012345555555554321000000000000000000000000000000000",
"00000000000000000000000000000000000012345666666654321000000000000000000000000000000000",
"00000000000000000000000000000000000012345677777654321000000000000000000000000000000000",
"00000000000000000000000000000000000012345678887654321000000000000011111000000000000000",
"00000000000033333333300000000000000012345678987654321000000000000011111000000000000000",
"00000000000033333333300000000000000012345678887654321000000000000022222000000000000000",
"00000000000033333333300000000000000012345677777654321000000000000022222000000000000000",
"00000000000000000000000000000000000012345666666654321000000000000033333000000000000000",
"00000000000000000000000000000000000012345555555554321000000000000033333000000000000000",
"00000000000000000000000000000000000012344444444444321000000000000044444000000000000000",
"00000000000055555555500000000000000012333333333333321000000000000044444000000000000000",
"00000000000055555555500000000000000012222222222222221000000000005555555550000000000000",
"00000000000055555555500000000000000011111111111111111000000000005555555550000000000000",
"00000000000000000000000000000000000000000000000000000000000000005555555550000000000000",
"00000000000000000000000000000000000000000000000000000000000000005555555550000000000000",
"00000000000000000000000000000000000000000000000000000000000000005555555550000000000000",
"00000000000077777777700000000000000000000000000000000000000000005555555550000000000000",
"00000000000077777777700000000000000011111111111111111000000000005555555550000000000000",
"00000000000077777777700000000000000012222222222222221000000000005555555550000000000000",
"00000000000000000000000000000000000012333333333333321000000000005555555550000000000000",
"00000000000000000000000000000000000012344444444444321000000000000000000000000000000000",
"00000000000000000000000000000000000012345555555554321000000000000000000000000000000000",
"00000000000099999999900000000000000012345666666654321000000000000000000000000000000000",
"00000000000099999999900000000000000012345677777654321000000000000000000000000000000000",
"00000000000099999999900000000000000012345678887654321000000000000000000000000000000000",
"00000000000099999999900000000000000012345678987654321000000000000000000000000000000000",
"00000000000099999999900000000000000012345678887654321000000000000000000000000000000000",
"00000000000000000000000000000000000012345677777654321000000000000000000000000000000000",
"00000000000000000000000000000000000012345666666654321000000000000000000000000000000000",
"00000000000000000000000000000000000012345555555554321000000000000000000000000000000000",
"00000000000000000000000000000000000012344444444444321000000000000000000000000000000000",
"00000000000000000000000000000000000012333333333333321000000000000000000000000000000000",
"00000000000000000000000000000000000012222222222222221000000000000000000000000000000000",
"00000000000000000000000000000000000011111111111111111000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
}
setContext(img)
for x=1,600 do
for y=1,400 do
p=math.floor(x/100)
b1=level(x,y)*2
if p==0 then
r=math.random(240)
g=r
b=r
else
r,g,b=img:get(x-100+b1+1,y)
end
img:set(x,y,r,g,b,255)
end
end
setContext()
end
function draw()
background(40, 40, 50)
sprite(img,WIDTH/2+100,HEIGHT/2+100)
end
function level(x,y)
if x>150 and y>50 then
xo=math.ceil((x-150)/5)
yo=math.ceil((y-50)/5)
if xo>85 or yo>59 then
return(0)
end
return(string.sub(tab[yo],xo,xo))
end
return(0)
end