'+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
'+                 Hypno by Gareth Bailey                +
'+                       June 2002                       +
'+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

open window 40,40
tri=20
mv=1
zm=5
z=100

dim xpt(tri), ypt(tri),ang(tri)
dim xp2(tri), yp2(tri),an2(tri)

txt$="Quite a nice effect dont you think? :-), this was ent"
txt$=txt$+"ered in the 40 line demo competition in a compres"
txt$=txt$+"sed form, thanks to shockwave and the yabasic for"
txt$=txt$+"ums for the competition!"
txtend=-30-(len(txt$)*10): tx=660

for a=1 to tri
 ang(a)=a*(360/tri) 
 an2(a)=a*(360/tri)
next a

dim sinn(380), cosn(380)

for a=1 to 380
 cosn(a)=cos(a*(pi/180))
 sinn(a)=sin(a*(pi/180)) 
next

repeat
 clear window
 z=z+zm
 if z>220 or z<100 zm=0-zm
 m2=m2+1

 if m2=200 then
   mv=0-mv
   m2=0
 fi

 for a=1 to tri
   xpt(a)=cosn(ang(a))*z+320
   ypt(a)=sinn(ang(a))*z+256
   ang(a)=ang(a)+(mv*2)
   
   if sig(mv)=1  if ang(a)>360 ang(a)=ang(a)-360
   if sig(mv)=-1 if ang(a)<=0  ang(a)=ang(a)+360 

  xp2(a)=cosn(an2(a))*500+320
  yp2(a)=sinn(an2(a))*500+256
  an2(a)=an2(a)-(mv*2) 

  if sig(mv)=-1if an2(a)>360 an2(a)=an2(a)-360
  if sig(mv)=1 if an2(a)<=0  an2(a)=an2(a)+360
 next a

 nc=nc+1
 colr=(sin(nc/10)*155)+100
 colg=(sin(nc/15)*155)+100
 colb=(sin(nc/20)*155)+100

 for a=1 to tri
  b=a+1
  if b>tri b=1
  setrgb 1,0,0,0
  setrgb 3,colr,colg,255 
  setrgb 2,colr,colg,255

  if mod(a,2)=0 setrgb 1,255,colg,colb

  gtriangle 320,256 to xp2(a),yp2(a) to xp2(b),yp2(b)
 next a

 for a=1 to tri
  b=a+1
  if b>tri b=1
  setrgb 1,0,0,0
  setrgb 3,255,colg,colb
  setrgb 2,255,colg,colb 
 
  if mod(a,2)=0 setrgb 1,colr,colg,255

  gtriangle 320,256 to xpt(a),ypt(a) to xpt(b),ypt(b)
 next a

 setrgb 1,255,255,255
 gtriangle 320,480 to 640,480 to 640,500
 gtriangle 320,480 to 0  ,480 to 0  ,500

 setrgb 2,255,255,255
 gtriangle 320,480 to 320,500 to 640,500
 gtriangle 320,480 to 320,500 to 0,500

 setrgb 1,0,0,0
 rect 0,480 TO 640,500
 text tx,495,txt$,"lc":tx=tx-2:if tx<txtend tx=660

 gosub db
until (peek("port1")=16384)
end

label db
setdispbuf draw
draw = 1 - draw
setdrawbuf draw
return


