aUCBLogo Demos and Tests / eastereggs
be eastereggs [singleshot false][FrameNr 0]
cs ht
perspective
setLightAmbient hsb 0 0 .8
setLightDiffuse hsb 0 0 .5
setLightSpecular "white
setMaterialSpecular "white
setMaterialShininess 20
terracotta=hsb 0 .5 .7
setPC terracotta
vase
brown=hsb 0 .3 .02
setPC brown
wool=hsb 0 .2 .2
mincatkin=20
setPenSize [2 2]
ori=Orientation
eggpos=[]
repeat 20
[ rr random 360
rt random 20
catkin 300*(rnd+1)/2
setOrientation ori
]
eggs
ifelse singleshot
[ (rotateScene2 1 true FrameNr*10)
][ rotatescene2
]
be vase
pu bk 300 pd
p0=PosXYZ
p=[[0 2][3 3][5 4][6 4.5][8 5][11.5 5][12.5 3][13 2][16 3][16.5 3]]
n=count p
pt=0
r=0
h=0
SurfaceStart
repeat n
[ aux
for [s 0 360 15]
[ cyl1 :r*12 :s :h*12
]
SurfaceColumn
]
SurfaceEnd
pu setPosXYZ p0 fd :h*6 pd
be aux
pt=first p
r=last pt
h=first pt
p=bf p
end
be cyl1 :r :s :h
setPosXYZ (list :r*cos :s :h :r*sin :s)+:p0
end
end
be catkins length
n=trunc length/mincatkin
repeat n
[ ifelse rnd > .5
[ pu left 20 fd 7 pd
setPC wool
Ellipsoid 4 8 4
pu bk 7 right 20 pd
][ pu left 20 fd 4 pd
setPC brown
Ellipsoid 2.5 5 2.5
pu bk 4 right 20 pd
]
setPC brown
fd mincatkin
]
ifelse n != 0
[ fd length-n*mincatkin
][ fd length
]
end
be catkin length
catkins length
if length > mincatkin
[ if length/2 < mincatkin and2 rnd > 0.8
[ push "eggpos PosXYZ
]
local [a]
a=50+20*2*(rnd-0.5)
rt a
(catkin length/2*(rnd+1)/2)
lt a
a=20*2*(rnd-0.5)
lt a
(catkin length/2*(rnd+1)/2)
rt a
]
pu bk length pd
end
be egg [size 50][r size*0.85]
p0=PosXYZ
SurfaceStart
for [theta 0 180 10]
[ for [phi 0 360 10]
[ setPosXYZ (list
r * (sin theta)*sin phi
-size*((cos theta)+(sqr cos theta/4)*0.6)
r * (sin theta)*cos phi)+p0
]
SurfaceColumn
]
SurfaceEnd
pu setPosXYZ p0 pd
end
be eggs
foreach eggpos
[ pu setPosXYZ ? pd
setPenSize [1 1]
setY yCor-40-random 20
setPenColor hsb random 360 1 1
(egg 20)
]
end
end