Code: Select all
REM Fade out/in (Blocks)
REM iPhone 6 Plus / 8.3 b3
REM good for screen transisions
REM Enjoy..
init:
graphics
sw=screen_width()
sh=screen_height()
dim trix(4),triy(4)
Fadeblocks:
'graphics clear 0,0,0
rndRes = int(rnd(260))+40 'random block size
xRes = rndRes ! yRes = rndRes
draw_xRes = sw*2/xRes
draw_yRes = sh /yRes
nrBlocks = xRes*yRes
dim b_drawOrder(nrBlocks+1)
for i=0 to nrBlocks
b_drawOrder(i) = i
next i
oldr=r!oldg=g!oldb=b
r=rnd(1)!g=rnd(1)!b=rnd(1)
fill color r,g,b
'triangle 0,0 to sw,0 to sw,sh
trix(0)=0
triy(0)=0
trix(1)=sw
triy(1)=0
trix(2)=sw
triy(2)=sh
fill poly trix,triy count 3
'triangle 0,0 to 0,sh to sw,sh
trix(0)=0
triy(0)=0
trix(1)=0
triy(1)=sh
trix(2)=sw
triy(2)=sh
fill poly trix,triy count 3
for i=0 to nrBlocks
rndPlace = rnd(nrBlocks)
temp = b_drawOrder(i)
b_drawOrder(i) = b_drawOrder(rndPlace)
b_drawOrder(rndPlace) = temp
next i
rndBlue = rnd(1)
for i = 0 to nrBlocks
block = b_drawOrder(i)
by = int(block/xRes)+1
bx = block-(by*xRes)+xRes
draw_y = (by-1)*draw_yRes
draw_x = bx*draw_xRes
fill color oldr,oldg,oldb
fill rect draw_x,draw_y to draw_x+draw_xRes+1,draw_y+draw_yRes+1
next i
pause .1
goto FadeBlocks