BW Triangle Scroller

Post Reply
DrChip
Posts: 167
Joined: Wed Oct 22, 2014 3:26 pm
My devices: iPhone 4 to 6+,iPad mini to iPad air 2

BW Triangle Scroller

Post by DrChip »

REM BW Triangle Scroller
REM iPhone 6 Plus / iOS 8.2 b4
REM Enjoy...

graphics
sw=screen_width()
sh=screen_height()
tri=100

dim x1(tri+1),y1(tri+1),x2(tri+1),y2(tri+1),x3(tri+1),y3(tri+1)

for i=1 to tri
x1(i)=rnd(sw)!y1(i)=rnd(sh)
x2(i)=rnd(sw)!y2(i)=rnd(sh)
x3(i)=rnd(sw)!y3(i)=rnd(sh)
next i

loop:
refresh off
graphics clear 0,0,0

for i=1 to tri
y1(i)=y1(i)+6
y2(i)=y2(i)+6
y3(i)=y3(i)+6
if y1(i)>=sh then
y1(i)=0
x1(i)=rnd(sw)
end if
if y2(i)>=sh then
y2(i)=0
x2(i)=rnd(sw)
end if
if y3(i)>=sh then
y3(i)=0
x3(i)=rnd(sw)
end if
'fill triangle x1(i),y1(i) to x2(i),y2(i) to x3(i),y3(i)
trix(0)=x1(i)
triy(0)=y1(i)
trix(1)=x2(i)
triy(1)=y2(i)
trix(2)=x3(i)
triy(2)=y3(i)
fill poly trix,triy count 3
j=1-j
fill color (250*j)/255,(250*j)/255,(250*j)/255
'triangle x1(i),y1(i) to x2(i),y2(i) to x3(i),y3(i)
trix(0)=x1(i)
triy(0)=y1(i)
trix(1)=x2(i)
triy(1)=y2(i)
trix(2)=x3(i)
triy(2)=y3(i)
draw poly trix,triy count 3
next i
refresh on
goto loop
Attachments
image.jpg
image.jpg (237.81 KiB) Viewed 1730 times
image.jpg
image.jpg (229.01 KiB) Viewed 1730 times

Post Reply