Mystify
Posted: Tue Jan 27, 2015 8:10 pm
REM Mystify
REM iPhone 6 Plus / iOS 8.2 b4
REM Enjoy...
graphics
gosub setup
mystify:
do
refresh off
graphics clear 0,0,0
gosub draw
for a=1 to 24
'====move the corners====
x(a)=x(a)+dirx(a)
y(a)=y(a)+diry(a)
'====cheack if the corner has hit the side====
if x(a)<10 then dirx(a)=0-(dirx(a))
if x(a)>sw-10 then dirx(a)=0-dirx(a)
if y(a)>sh-10 then diry(a)=0-diry(a)
if y(a)<10 then diry(a)=0-diry(a)
next a
gosub scrolltxt
refresh on
until 1=2
end
draw:
cc=cc+0.1
red=50+50*sin(cc/2)
blu=50+50*sin(cc/3)
grn=50+50*sin(cc/4)
fill color red,grn,blu
'draw color 0,0,0
fill rect 0,0 to sw,sh
fill color .23,.23,.23
fill rect 10,10 to sw-10,sh-20
c=c+.15
draw color .75+50*sin(c/15),.75+50*sin(c/17),.75+50*sin(c/20)
for a=0 to 20 step 4
for b=1 to 3
if a>=12 then draw color .75+50*sin((c+75)/10),.75+50*sin((c+75)/15),.75+50*sin((c+75)/20)
draw line x(b+a),y(b+a) to x((b+1)+a),y((b+1)+a)
next b
draw line x(a+1),y(a+1) to x(a+4),y(a+4)
next a
return
scrolltxt:
draw color .75+50*sin((c2)/10),.75+50*sin((c2)/10),.75+50*sin((c2)/10)
c2=c2+.75
draw text "HELLO ALL!!!!" at sw/4,10
draw color 0,0,1
draw text txt$ at tx,ty
tx=tx-2
if tx<txtend then
tx=0
ty=sh-20
end if
return
setup:
sw=screen_width()
sh=screen_height()
'====setup arrays for polygons====
dim x(25)
dim y(25)
dim dirx(25)
dim diry(25)
'====set initial directions for corners polygons====
for a=1 to 4
read dirx(a)
read diry(a)
next a
for a=5 to 12
if a>4 then b=4! if a>8 then b=8
dirx(a)=dirx(a-4)
diry(a)=diry(a-4)
next a
for a=13 to 16
read dirx(a)
read diry(a)
next a
for a=17 to 24
dirx(a)=dirx(a-4)
diry(a)=diry(a-4)
next a
'====set initial positions for the corners====
for a=1 to 24
read x(a)
read y(a)
next a
'=====Setup Scroll text=====
txt$= "Thanks for watching this boring demo. "
txt$=txt$&"tried to make a colorful backdrop, Enjoy "
txtend=-30-(len(txt$)*12)
tx=sh-20
ty=sh-20
return
'====data for the directions====
data -1,-1,1,1,1,-1,-1,1
data 1,1,-1,-1,-1,1,1,-1
'====data for the positions====
data 200,200,200,300,300,300,300,200
data 205,205,205,305,305,305,305,205
data 210,210,210,310,310,310,310,210
data 150,150,250,150,150,250,250,250
data 155,155,255,155,155,255,255,255
data 160,160,260,160,160,260,260,260
REM iPhone 6 Plus / iOS 8.2 b4
REM Enjoy...
graphics
gosub setup
mystify:
do
refresh off
graphics clear 0,0,0
gosub draw
for a=1 to 24
'====move the corners====
x(a)=x(a)+dirx(a)
y(a)=y(a)+diry(a)
'====cheack if the corner has hit the side====
if x(a)<10 then dirx(a)=0-(dirx(a))
if x(a)>sw-10 then dirx(a)=0-dirx(a)
if y(a)>sh-10 then diry(a)=0-diry(a)
if y(a)<10 then diry(a)=0-diry(a)
next a
gosub scrolltxt
refresh on
until 1=2
end
draw:
cc=cc+0.1
red=50+50*sin(cc/2)
blu=50+50*sin(cc/3)
grn=50+50*sin(cc/4)
fill color red,grn,blu
'draw color 0,0,0
fill rect 0,0 to sw,sh
fill color .23,.23,.23
fill rect 10,10 to sw-10,sh-20
c=c+.15
draw color .75+50*sin(c/15),.75+50*sin(c/17),.75+50*sin(c/20)
for a=0 to 20 step 4
for b=1 to 3
if a>=12 then draw color .75+50*sin((c+75)/10),.75+50*sin((c+75)/15),.75+50*sin((c+75)/20)
draw line x(b+a),y(b+a) to x((b+1)+a),y((b+1)+a)
next b
draw line x(a+1),y(a+1) to x(a+4),y(a+4)
next a
return
scrolltxt:
draw color .75+50*sin((c2)/10),.75+50*sin((c2)/10),.75+50*sin((c2)/10)
c2=c2+.75
draw text "HELLO ALL!!!!" at sw/4,10
draw color 0,0,1
draw text txt$ at tx,ty
tx=tx-2
if tx<txtend then
tx=0
ty=sh-20
end if
return
setup:
sw=screen_width()
sh=screen_height()
'====setup arrays for polygons====
dim x(25)
dim y(25)
dim dirx(25)
dim diry(25)
'====set initial directions for corners polygons====
for a=1 to 4
read dirx(a)
read diry(a)
next a
for a=5 to 12
if a>4 then b=4! if a>8 then b=8
dirx(a)=dirx(a-4)
diry(a)=diry(a-4)
next a
for a=13 to 16
read dirx(a)
read diry(a)
next a
for a=17 to 24
dirx(a)=dirx(a-4)
diry(a)=diry(a-4)
next a
'====set initial positions for the corners====
for a=1 to 24
read x(a)
read y(a)
next a
'=====Setup Scroll text=====
txt$= "Thanks for watching this boring demo. "
txt$=txt$&"tried to make a colorful backdrop, Enjoy "
txtend=-30-(len(txt$)*12)
tx=sh-20
ty=sh-20
return
'====data for the directions====
data -1,-1,1,1,1,-1,-1,1
data 1,1,-1,-1,-1,1,1,-1
'====data for the positions====
data 200,200,200,300,300,300,300,200
data 205,205,205,305,305,305,305,205
data 210,210,210,310,310,310,310,210
data 150,150,250,150,150,250,250,250
data 155,155,255,155,155,255,255,255
data 160,160,260,160,160,260,260,260