Showing posts with label Animation. Show all posts
Showing posts with label Animation. Show all posts

Friday, December 28, 2012

Gears

clg
fastgraphics
dim x(3)
dim y(3)
dim rad(3)
dim init(3)
x[0]=150
y[0]=150
rad[0]=70
init[0]=0
x[1]=220
y[1]=220
rad[1]=35
init[1]=-.15
x[2]=90
y[2]=90
rad[2]=21
init[2]=.2
for rot = 0 to 100000
   for w = 0 to 2
      circle x[w],y[w],rad[w]-8
      tri = {0, 0, -5, rad[w], 5, rad[w]}
      for r = 0 to 2*pi step pi*7/rad[w]
           if w=1 or w=2 then clock = -rot
           if w=0 then clock = rot
           stamp x[w],y[w],1,r+init[w]+clock/(7*rad[w]),tri
       next r
    next w
    refresh
    clg
next rot

Sunday, November 11, 2012

3D Bounce

graphsize 900,450
fastgraphics
vx=2
vy=3
vz=5
x=10
y=10
z=14
Loop:
color darkred
rect 0,0,900,450
color rgb(0,123,0)
poly{0,300,450,450,900,300,450,150}
color rgb(0,83,0)
poly{0,300,450,150,450,0,0,150}
color rgb(0,103,0)
poly{900,300,450,150,450,0,900,150}
color red
vz=vz-.05
x=x+vx
y=y+vy
z=z+vz
vz=vz-.05
h=(x+y)*cos(1/3)
v=300-(-x+y)*sin(1/3)
if x>465 then vx=-vx
if x<0 then vx=-vx
if y>465 then vy=-vy
if y<0 then vy=-vy
if z<0 then vz=-vz
color black
rect h,v,10,2
color red
circle h,v-z,10
refresh
clg
goto Loop

Wednesday, October 31, 2012

Walk on by


# A rough attempt to model human walking
clg
graphsize 900,300
Fastgraphics
Dim limb(8)
limb = {0, 0, 0, 100, 10, 100,10,0}
y=140
people=10
Dim x(people)
Dim dx(people)
Dim r(people)
Dim g(people)
Dim b(people)
For n=0 to people-1
x[n]=int(rand*900)
dx[n]=(-1)^int(rand*2+1)
r[n]=int(rand*255)
g[n]=int(rand*255)
b[n]=int(rand*255)
next n
For p=0 to 10000
gosub walkman
next p
walkman:
clg
For n=0 to people-1
color r[n],g[n],b[n]
x[n]=x[n]+dx[n]
if x[n]<0 then x[n]=900
if x[n]>900 then x[n]=0
ywable=-10*abs(sin(x[n]*.03+pi/2))
xwable=-30*abs(sin(x[n]*.03))
leftrot=sin(x[n]*.03)/2
rightrot=sin(x[n]*.03+pi)/2
circle x[n]-xwable+5,y+ywable-25,15
stamp x[n]-xwable,y+60+ywable,1,leftrot,limb
stamp x[n]-xwable,y+ywable,.8,leftrot,limb
color r[n],0,b[n]
rect x[n]-10-xwable,y+ywable,30,70
color rgb( r[n],g[n],b[n])
stamp x[n]-xwable,y+60+ywable,1,rightrot,limb
stamp x[n]-xwable,y+ywable,.8,rightrot,limb
next n
refresh
return

Friday, November 19, 2010

Christmas


fastgraphics
dim x$(62,62)
For y = 1 to 60
For x = 1 to 60
if int(rand*50)=5 then x$[x,y]="*"
next x
next y
For pass = 1 to 3
For n = 1 to 300
clg
color black
rect 0,0,300,300
color white
rect 0,250,300,50
circle 0,300,100
circle 200,300,80
circle 100,245,10
circle 100,230,5
circle 250,50,15
For y = 1 to 60
For x = 1 to 60
text x*5,n+y*5, x$[x,y]
if n+y*5>300 then text x*5,n+y*5-300, x$[x,y]
next x
next y
Text n,130," ^           '' "
Text n,135," 0_ ....../> "
Text n,145,"( )_, "
Text n,150,"____/ / \"
refresh
next n
next pass