@genocode/core 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genocode/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "The GenoCode language: parser, checker, formatter, interpreter and genetics.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -0,0 +1,79 @@
1
+ creature Flowerball
2
+ // A ball of beads in rings, which opens out into a flat disc, crowned by five curling petals.
3
+ // Inspired by Flowerball, a DancerDNA creature.
4
+
5
+ gene open = 0.63 in 0..1 // 0 lays the beads flat in a disc; 1 rounds them into a ball and fills out the petals
6
+ gene gloss = 0.64 in 0..1 // how strong the highlights are
7
+ gene focus = 0.21 in 0..1 // how tight the highlights are
8
+ gene lift = 14.5 in -20..20 // how far from the beads the petals grow, as the creature opens
9
+
10
+ shine gloss
11
+ sharpness focus
12
+ beads
13
+ forward lift * open
14
+ pitch 90
15
+ repeat 5 {
16
+ petal
17
+ yaw 72
18
+ }
19
+
20
+ // Eight rings of beads around the heading. Ring 0 is the middle and has no beads.
21
+ part beads {
22
+ gene radius = 1 in 1..15 // the ball's radius, when it's fully open
23
+ gene bead = 0.92 in 0.1..1 // the size of each bead
24
+ gene inner = hsv(127, 0.45, 0.3) in hsv(0, 0.4, 0)..hsv(360, 1, 1)
25
+ gene second = hsv(41, 0.95, 0.73) in hsv(0, 0.4, 0)..hsv(360, 1, 1)
26
+ gene third = hsv(333, 0.96, 0.21) in hsv(0, 0.4, 0)..hsv(360, 1, 1)
27
+ gene outer = hsv(59, 0.8, 0.95) in hsv(0, 0.4, 0)..hsv(360, 1, 1)
28
+
29
+ let skin = gradient(inner, second, third, outer)
30
+ shape ball
31
+ repeat 8 as r {
32
+ let a = 180 * r / 8
33
+ colour skin(r / 8)
34
+ // Flat, ring r is r from the middle. As a ball, it's a circle of latitude.
35
+ let spread = mix(r, sin(a) * radius, open)
36
+ let height = open * cos(a) * radius
37
+ let circle = tau * r
38
+ repeat floor(circle) as s {
39
+ let t = 360 * s / circle
40
+ branch {
41
+ move (spread * cos(t), spread * sin(t), height)
42
+ lay { grow bead }
43
+ }
44
+ }
45
+ }
46
+ }
47
+
48
+ // A curling chain of stretched beads, fattest in the middle.
49
+ part petal {
50
+ gene curl = -0.86 in -2.5..2.5 // how far the petal curls, and which way
51
+ gene tip = hsv(285, 0.66, 0.3) in hsv(0, 0.4, 0)..hsv(360, 1, 1)
52
+ gene edge = hsv(2, 0.43, 0.96) in hsv(0, 0.4, 0)..hsv(360, 1, 1)
53
+ gene flank = hsv(90, 0.93, 0.61) in hsv(0, 0.4, 0)..hsv(360, 1, 1)
54
+ gene heart = hsv(131, 0.56, 0.49) in hsv(0, 0.4, 0)..hsv(360, 1, 1)
55
+
56
+ let skin = gradient(tip, edge, flank, heart)
57
+ branch {
58
+ forward 2.5
59
+ pitch -36
60
+ yaw -45
61
+ roll -30
62
+ shape ball
63
+ for i from 1 to 29 {
64
+ let swell = bump(i / 30)
65
+ colour skin(swell)
66
+ yaw 6
67
+ branch {
68
+ forward 0.1
69
+ pitch 90 * swell * curl
70
+ lay { grow (open, open, open * 6 * (swell + 1)) }
71
+ }
72
+ move (0.4 * open, 0, 0)
73
+ }
74
+ }
75
+ }
76
+
77
+ background {
78
+ fill gradient(hsv(250, 0.5, 0.12), hsv(200, 0.45, 0.4))
79
+ }