1asset cotton_candy_cart "Cotton candy cart" complexity=4
2// a candy-striped cart on two big wheels: a brass spinning drum on top whirling a pink cloud of
3// floss, a rack of finished cones, a push handle, and a scalloped parasol with a bulb on each rib
4let L = 1.4..1.55
5let stA = pink:3|bubblegum|lilac
6let stB = white:3|cream
7let trim = cobalt:2|teal|grape
8let flossA = pink:3|bubblegum
9let flossB = sky:2|lilac|lemon
10let metal = silver:2|brass
11let bulbC = glow:3|sunflower
12
13// the cart body on its wheels, a front leg and the push handle
14box body at=(0, .42, 0) size=(L, .78, .82) round=.08 stripes=[stA stB] panels=8 bands=[.88:trim] color=stA
15box top on=body at=(0, .78, 0) size=(L+.1, .08, .92) round=.03 color=trim
16wheel wheel at=(.48, .36, -.22) mirror r=.36 w=.12 hub=stB tyre=trim
17cyl leg on=body at=(0, -.42, .3) h=.42 r=.05 color=metal segs=8
18rod handle on=body at=(-L/2+.04, .62, 0) rot=(0, 0, 18) to=(-.42, 0, 0) r=.035 sides=6 color=metal
19rod grip on=handle at=end+(0, 0, -.32) to=(0, 0, .64) r=.045 sides=8 color=trim
20
21// the spinning drum and its cloud of floss
22lathe drum on=top at=(.12, .08, 0) h=.3 r=.34 prof=[0:.45 .3:.9 1:1] open=top color=metal segs=20 rings=5
23torus lip on=drum at=(0, .3, 0) R=.34 r=.03 color=metal segs=20 sides=5
24puff floss on=drum at=(0, .36, 0) r=(.42, .28, .42) color=flossA noise=.16 segs=14 rings=8 joint
25puff wisp x5 on=floss ring=12 at=(.26, .1, 0) r=.15 color=flossA noise=.14 segs=8 rings=5
26
27// a rack of finished cones
28box rack on=top at=(-.45, .08, 0) size=(.32, .1, .6) round=.03 color=trim
29cone stick x3 on=rack at=(0, .1, 0) row=(0, 0, .2) h=.36 r=.03 r2=.015 color=stB segs=6
30puff candy on=stick at=(0, .42, 0) r=(.12, .15, .12) color=sel(parent.i, flossA, flossB, flossA) noise=.1 segs=10 rings=6
31
32// the parasol
33rod pole on=top at=(-.1, .08, -.36) to=(0, 1.55, 0) r=.035 sides=6 color=metal
34cone brolly on=pole at=end+(0, -.08, 0) h=.42 r=.95 r2=.04 stripes=[stA stB] panels=8 scallop=.04 color=stA segs=32
35ball tip x8 on=brolly ring ring0=22.5 at=(.93, -.02, 0) r=.06 color=bulbC ink=glow segs=8 rings=5
36ball knob on=brolly at=(0, .42, 0) r=.06 color=metal segs=8 rings=5
37
38// the drum whirls and the floss grows and settles
39anim floss ry spin hz=.6
40anim floss s sin amp=.06 hz=.4
41