1asset sun_lamp "Sunny the sun lamp" complexity=5
2// the Sun Room's centrepiece and the company mascot: a big glowing sun with a sleepy-happy face, held
3// up on a curved brass arm from a round stepped base, with a crown of chunky rays that slowly turns and
4// a halo ring; it bobs gently like it is floating
5let S = .95..1.05
6let sunC = sunflower:3|marigold
7let rayC = tangerine:2|marigold|coral
8let baseC = navy:2|plum|walnut|teal
9let metal = brass:3|copper
10
11// the base and the arm
12cyl base h=.16 r=.6*S round=.05 color=baseC segs=32
13cyl step on=base at=(0, .16, 0) h=.1 r=.42*S round=.04 color=baseC*1.15 segs=28
14tube arm on=step at=(0, .1, 0) pts=[0,0,0 0,.6,-.05 .05,1.2,-.25 0,1.65,-.45 0,1.95,-.4] r=(.06, .045) smooth sides=10 color=metal
15
16// the sun: a glowing ball with a face, a ring of rays and a halo
17ball sun on=arm at=(0, 2.15*S, -.05) r=.5*S color=sunC ink=glow segs=28 rings=18 joint
18face sunny on=sun eyes=happy mouth=grin blush size=.16 spacing=24 eyeY=10 mouthY=-18 mouthW=.42
19cyl hub on=sun at=(0, 0, -.06) rot=(90, 0, 0) h=.04 r=.1 color=rayC segs=10 joint
20cone ray x12 on=hub ring at=(.66*S, .02, 0) rot=(0, 0, -90) h=.26*S r=.09*S depth=.5 color=sel(i, rayC, sunC, rayC, sunC, rayC, sunC, rayC, sunC, rayC, sunC, rayC, sunC) ink=glow segs=8
21torus halo on=sun rot=(90, 0, 0) at=(0, 0, -.12) R=.98*S r=.03 color=sunC*1.1 ink=glow segs=48 sides=6
22
23anim sun py sin amp=.04 hz=.35
24anim hub ry spin hz=.05
25