rem shapes
rem latch
rem 9/23/2008
 
sync on
sync rate 0
set display mode 640,480,32
 
rem radial sphere
radial_shade(screen width()/2,screen width()/2,screen height()/2,255,128,64,10)
sync
 
ink rgb(255,255,0),0
rem circle
x=128
y=128
for r=0 to 63
   circle x,y,r
   circle x,y-1,r
next r
sync
 
rem ellipse
for xr=0 to 63
   for yr=0 to 10
      ellipse x+350,y,xr,yr
      ellipse x+350,y-1,xr,yr
   next yr
next xr
sync
 
rem triangle
x1#=screen width()/2
y1#=screen height()/2
x2#=x1#
y2#=y1#
x3#=x1#
y3#=y1#
for f=0 to 500
   dec y1#,.1
   dec x2#,.1
   inc y2#,.1
   inc x3#,.1
   inc y3#,.1
   line x1#,y1#,x2#,y2#
   line x2#,y2#,x3#,y3#
   line x3#,y3#,x1#,y1#
next f
sync
 
rem box
for y=350 to 400
   line 150,y,500,y
next y
sync
 
wait key
end
 
function radial_shade(radius,cx,cy,rclr,gclr,bclr,shade)
   rem radial shading function by latch
   divr#=(1.0*rclr)/(radius+shade)*1.0
   divg#=(1.0*gclr)/(radius+shade)*1.0
   divb#=(1.0*bclr)/(radius+shade)*1.0
 
   for r=0 to radius-1
      c=rgb(rclr-(r*divr#),gclr-(r*divg#),bclr-(r*divb#))
      ink c,0
      circle cx,cy,r
      circle cx,cy-1,r
   next r
 
endfunction