See: https://nitisara.ru/forum/viewtopic.php?t=2335.
I simplified it into a little function, which may be called in any (graphics) program with some spare space on the screen.
Code: Select all
graphics ! graphics clear .8,.8,.8 ! draw color 0,0,0
draw text " touch screen for next ""piece of art""" at 50,10
randomize
while(1)
art(100,100,300,500)
do slowdown ! until touch_x(0)>0
end while
end
' museum of modern art, free tour along the paintings
' graphics mode assumed
' x,y,w,h are position and size of the paintings
'
def art(x,y,w,h)
refresh off ! draw color .5,.5,.5
w-=odd(w) ! t=6 ! npx=w/2-t ! npy=h/2-t
xs=x+t/3-1 ! ys=y+t/3-1 ! toggle=0
dim va(npx+2),vb(npx+2),r(11)
draw size t ! draw rect x,y to x+w-t-1,y+h-t ! randomize
for i=1 to 10 ! r(i)=rnd(4) ! next i
for i=1 to npx ! va(i)=rnd(4) ! next i
for k=0 to npy ! yy=ys+2*k+2
for i=1 to npx
if toggle=0 then ! s=r(va(i-1)+va(i)+va(i+1)) ! vb(i)=s
else ! s=r(vb(i-1)+vb(i)+vb(i+1)) ! va(i)=s
end if
if s=0 then fill color 0,0,0
if s=1 then fill color 1,0,0
if s=2 then fill color 0,1,0
if s=3 then fill color 0,0,1
xx=xs+2*i ! fill rect xx,yy to xx+1,yy+1
next i ! toggle=1-toggle
next k
refresh on
end def