Sproutlet · celworld
seed

Sproutlet

sproutlet v1Made by APIc4
Open in Playground

v1 cost

$0.262

API, priced from the call usage.

Time
66s
The run, with the maths
All 1 version$0.262

Budget

c4 · 47 lines
Shapes16 / 70
Triangles3,900 / 6,000
Draw calls2 / 4
States
idle · happy
Made
1asset sproutlet "Sproutlet" complexity=4
2// a leaf-sprite pocket critter: a round seed body that is also its head, big shiny eyes,
3// stubby arms, two short legs on fat feet, a stem with a big two-leaf sprout on top.
4// idle: a gentle sway with blinks and leaves rustling; happy: hops with the leaves flapping.
5// colourways: garden (common), acorn (common), shiny blossom (rare)
6let S = .9..1.1
7let leafS = .9..1.15
8let pal = "garden":5|"acorn":4|"shiny":.6
9let K = (pal=="acorn") + 2*(pal=="shiny")
10let bodyC = sel(K, lime, honey, bubblegum)
11let bellyC = sel(K, cream, cream, white)
12let sproutC = sel(K, leafA, leafPaint, sunflower)
13let rimC = sel(K, leafDark, leafB, tangerine)
14let stemC = sel(K, stem, oak, coral)
15let eyeC = sel(K, walnut, bottle, cobalt)
16let footC = sel(K, bottle, walnut, plum)
17
18// seed body: the root bone (head and body in one)
19ball body at=(0, .3*S, 0) r=(.22, .24, .2)*S color=bodyC segs=24 rings=14 joint
20ball belly on=body surf=(0, -38) upright lift=-.09*S r=(.15, .12, .09)*S color=bellyC segs=14 rings=8
21ball nub on=body surf=(180, -20) lift=-.03*S r=(.05, .07, .05)*S color=bodyC segs=10 rings=6
22
23// legs and fat feet, stubby arms
24limb leg on=body at=(.095*S, -.17*S, 0) mirror len=.07*S r=(.06, .055)*S color=bodyC segs=10 joint
25ball foot on=leg at=(0, -.085*S, .03*S) r=(.075, .045, .095)*S color=footC segs=12 rings=7
26limb arm on=body at=(.19*S, -.02*S, .02*S) mirror roll=35 len=.08*S r=(.045, .038)*S color=bodyC segs=10 joint
27
28// the sprout: a stem and two big leaves with a darker rim
29cyl stalk on=body at=top+(0, -.02*S, 0) h=.09*S r=.028*S r2=.022*S round=.008 color=stemC segs=8 joint
30slab frond on=stalk at=top+(.005*S, -.01*S, 0) mirror roll=28 scale=leafS*S pts=[0,0 .06,.07 .16,.1 .26,.08 .33,.02 .27,-.03 .15,-.045 .05,-.03] t=.03 round=.012 edge=rimC color=sproutC joint
31slab bud on=stalk at=top+(0, -.01*S, -.01*S) tilt=-15 scale=S pts=[-.03,0 .03,0 .02,.06 0,.09 -.02,.06] t=.025 round=.01 color=rimC
32
33// face: big readable eyes, small smile
34face look on=body eyes=round mouth=smile size=.24 spacing=26 eyeY=10 mouthY=-12 mouthW=.28 iris=eyeC detail=.7
35// eyelids hidden in the body, they pop out over the eyes to blink
36ball lid on=body surf=(26, 10) mirror lift=-.05*S r=(.065, .03, .065)*S color=bodyC segs=10 rings=5 joint
37
38// idle: sway, rustle, blink
39anim idle: body sway amp=5 hz=.4
40anim idle: frond rz sin amp=6 hz=.7
41anim idle: arm rz sin amp=6 hz=.4
42anim idle: lid py keys=[0:0 .88:0 .93:.055 .98:0 1:0] hz=.3
43// happy: hop, leaves flapping, arms up
44anim happy: body py bounce amp=.09 hz=2
45anim happy: frond flap amp=35 hz=4
46anim happy: arm rz keys=[0:20 .5:80 1:20] hz=2
47anim happy: leg rx sin amp=15 hz=2 twin=.5
48