Sine Ball Demo

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

Sine Ball Demo

Post by DrChip »

Code: Select all

rem Sine ball demo.
rem iPhone 6 plus / 8.3 b4
rem Enjoy...

gosub setup

loop:
refresh off
'graphics clear 
fill color 20/255,(c1/4)/255,20/255
'triangle 0,0 to sw,sh to 0,sh
trix(0)=0
triy(0)=0
trix(1)=sw
triy(1)=sh
trix(2)=0
triy(2)=sh
'fill poly trix,triy count 3
'triangle 0,0 to sw,sh to sw,0
trix(0)=0
triy(0)=0
trix(1)=sw
triy(1)=sh
trix(2)=sw
triy(2)=0
'fill poly trix,triy count 3
 gosub balls
fill rect 0,sh-20 to sw,sh
draw color 100/255,100/255,50/255
s1=2+1*sin(mm)
s2=2+1*cos(mm/3)
slx=4*sin(mm)-4
sly=4*cos(mm)
offs=50*sin(mm)
draw text mid$(s$,p,76) at scx+offs-slx,sh-18-sly
draw text "ANARCHIC SPHERES DEMO!" at 30-slx,10-sly
draw color 140/255,140/255,70/255
draw text "ANARCHIC SPHERES DEMO!" at 33,10
draw text mid$(s$,p,76) at scx+offs,sh-20
scx=scx-2
if scx<-50 then
scx=scx+10
p=p+1
if p>len(s$)-1 then p=0
end if
refresh on
goto loop


balls:
fill color c1/255,c2/255,c3/255

off=off+2
if off>360 then off=off-360
n=(bobs*10)+1
 for a=1 to bobs
mm=mm+.01
c1=100*sin(mm+a)+100
c2=100*sin(mm+a/2)+100
c3=100*sin(mm+a/3)+100

 x=px(off+m)+sw/2+xt(m+off) '195
 y=py(off+n)+sh/2 '140
 for b=l+a to 360+l+a step 40
 'triangle (sx(b)*s1)+x,(sy(b)*s2)+y to (sx(b+40)*s1)+x,(sy(b+40)*s2)+y to x,y
trix(0)=(sx(b)*s1)+x
triy(0)=(sy(b)*s2)+y
trix(1)=(sx(b+40)*s1)+x
triy(1)=(sy(b+40)*s2)+y
trix(2)=x
triy(2)=y
fill poly trix,triy count 3
 next b
 m=m+10
 n=n-10
 next a

l=l+20
if l>40 then l=l-40
m=0
return

setup:
graphics
pi=3.1415
sw=screen_width()
sh=screen_height()

bobs=14
dim sx(721)
dim sy(721)
dim px(721)
dim py(721)
dim xt(721)
dim trix(4),triy(4)

for a=1 to 720
 xt(a)=100*sin(a*(pi/180))
 sx(a)=50*sin(a*(pi/180))
 sy(a)=50*cos(a*(pi/180))
 px(a)=200*sin(a*(pi/180)*2)+sw/4 
 py(a)=200*cos(a*(pi/180))+sh/6 
next a
s$="                                                                      "
s$=s$&"HI FOLKS!!!  CAN YOU ACTUALLY READ THIS SCROLL?? "
s$=s$&"  HOPE NOT BECAUSE THERE IS NOTHING WORTHWHILE IN "
s$=s$&"HERE!   THIS ONE'S A BIT DIFFERENT THOUGH, EH??   "
s$=s$&"   MORE PSYCHEDELIA..   NO 3D FOR A CHANGE.. STILL"
s$=s$&" LOOKS OK THOUGH, AND OF COURSE THE SCROLL IS "
s$=s$&"DIFFERENT!!!     BIG HELLOS TO ALL THAT KNOW ME "
s$=s$&"MR. K HAS A GREAT SITE!!   THAT'S ALL FOLKS.....  "
p=0
scx=-40
return
Attachments
image.jpg
image.jpg (204.88 KiB) Viewed 1286 times
image.jpg
image.jpg (173.63 KiB) Viewed 1286 times
image.jpg
image.jpg (137.48 KiB) Viewed 1286 times
image.jpg
image.jpg (138.95 KiB) Viewed 1286 times
image.jpg
image.jpg (166.88 KiB) Viewed 1286 times
Last edited by DrChip on Thu Jun 04, 2015 10:27 pm, edited 1 time in total.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Sine Ball Demo

Post by Mr. Kibernetik »

Thank you for the comment! :D

Post Reply