aUCBLogo Demos and Tests / domino
to domino
perspective
cs
setpencolor "red
setUpdateGraph false
hideTurtle
N=20
p=Array N
o=Array N
dt=FloatArray N
angle=FloatArray N
c=IntArray N
up 90
repeat N
[ i=repcount
fd 40 rt repcount
p.i=PosXYZ ;(List 0 0 i*40-300)
o.i=Orientation ;(List 0 0 0)
dt.i=10*i
angle.i=0
c.i=HSB 360*repcount/N 1 1
]
forever
[ t=repcount
cs
repeat N
[ i=repcount
setPosXYZ p.i
setOrientation o.i
down angle.i
setPC c.i
pcube
ti=t-dt.i
satt=ifelse ti < 0 [0][ti]
maxang=70*exp(-satt/200)
angle.i=20+abs maxang*cos satt
]
updateGraph
if key? [break]
]
end
be pCube [size 50][f1 2] ;PolyCube
pu
local [p]
p=PosXYZ
; bk size/2
; left 90 fd size/2 rt 90
; down 90 fd size/2 up 90
repeat 2
[ face size*f1 size
rt 90 fd size left 90 rightroll 90
face size*f1 size/f1
rt 90 fd size/f1 left 90 rightroll 90
]
down 90
face size/f1 size
up 90
fd size*f1
down 90
face size/f1 size
setPosXYZ p
be face size size2
pd polyStart
repeat 2
[ fd size rt 90
fd size2 rt 90
]
polyEnd pu
end
end