@kerf-js/keel 0.0.0-stage → 0.1.0

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.
Files changed (192) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +306 -2
  3. package/package.json +59 -3
  4. package/src/blend-inset.ts +79 -0
  5. package/src/blend.ts +120 -0
  6. package/src/client.d.ts +9 -0
  7. package/src/generate/bust.ts +24 -0
  8. package/src/generate/bust.worker.ts +4 -0
  9. package/src/generate/pack.ts +69 -0
  10. package/src/generate/plate.ts +51 -0
  11. package/src/generate/plate.worker.ts +4 -0
  12. package/src/generate/serve.ts +56 -0
  13. package/src/generate/surface.ts +16 -0
  14. package/src/generate/surface.worker.ts +4 -0
  15. package/src/generate.ts +133 -0
  16. package/src/governor.ts +87 -0
  17. package/src/index.d.ts +15 -0
  18. package/src/index.mjs +63 -0
  19. package/src/lit.d.ts +384 -0
  20. package/src/paint-live.ts +60 -0
  21. package/src/paint-recipe.d.mts +29 -0
  22. package/src/paint-recipe.mjs +29 -0
  23. package/src/paint-worker.mjs +20 -0
  24. package/src/paint.d.mts +37 -0
  25. package/src/paint.mjs +180 -0
  26. package/src/runtime.ts +35 -0
  27. package/src/scene.ts +289 -0
  28. package/src/stage.ts +192 -0
  29. package/vendor/LICENSE +21 -0
  30. package/vendor/LICENSE-modules +21 -0
  31. package/vendor/NOTICE +24 -0
  32. package/vendor/README.md +13 -0
  33. package/vendor/lit.d.mts +1 -0
  34. package/vendor/lit.mjs +2 -0
  35. package/vendor/lock.json +177 -0
  36. package/vendor/modules/band/events.d.ts +20 -0
  37. package/vendor/modules/band/index.d.ts +29 -0
  38. package/vendor/modules/band/player.d.ts +43 -0
  39. package/vendor/modules/band/roll.d.ts +14 -0
  40. package/vendor/modules/band/score.d.ts +45 -0
  41. package/vendor/modules/band/styles.data.d.ts +37 -0
  42. package/vendor/modules/band/voices.d.ts +33 -0
  43. package/vendor/modules/band.d.mts +1 -0
  44. package/vendor/modules/band.mjs +2 -0
  45. package/vendor/modules/butterflies/butterflies.glsl.d.ts +2 -0
  46. package/vendor/modules/butterflies/flight.d.ts +68 -0
  47. package/vendor/modules/butterflies/index.d.ts +79 -0
  48. package/vendor/modules/butterflies/wing.d.ts +38 -0
  49. package/vendor/modules/butterflies.d.mts +1 -0
  50. package/vendor/modules/butterflies.inputs.json +73 -0
  51. package/vendor/modules/butterflies.mjs +39 -0
  52. package/vendor/modules/camera-rail/index.d.ts +113 -0
  53. package/vendor/modules/camera-rail.d.mts +1 -0
  54. package/vendor/modules/camera-rail.mjs +2 -0
  55. package/vendor/modules/device-profile/index.d.ts +47 -0
  56. package/vendor/modules/device-profile.d.mts +1 -0
  57. package/vendor/modules/device-profile.mjs +2 -0
  58. package/vendor/modules/lit-finish/dress.d.ts +34 -0
  59. package/vendor/modules/lit-finish/finish.glsl.d.ts +15 -0
  60. package/vendor/modules/lit-finish/index.d.ts +33 -0
  61. package/vendor/modules/lit-finish/lit.d.ts +52 -0
  62. package/vendor/modules/lit-finish/pass.d.ts +35 -0
  63. package/vendor/modules/lit-finish/settings.d.ts +88 -0
  64. package/vendor/modules/lit-finish.d.mts +1 -0
  65. package/vendor/modules/lit-finish.inputs.json +200 -0
  66. package/vendor/modules/lit-finish.mjs +267 -0
  67. package/vendor/modules/look/index.d.ts +159 -0
  68. package/vendor/modules/look.d.mts +1 -0
  69. package/vendor/modules/look.inputs.json +23 -0
  70. package/vendor/modules/look.mjs +2 -0
  71. package/vendor/modules/motes/index.d.ts +83 -0
  72. package/vendor/modules/motes/motes.glsl.d.ts +9 -0
  73. package/vendor/modules/motes/place.d.ts +59 -0
  74. package/vendor/modules/motes.d.mts +1 -0
  75. package/vendor/modules/motes.inputs.json +116 -0
  76. package/vendor/modules/motes.mjs +68 -0
  77. package/vendor/modules/plate-painter/dab.d.ts +44 -0
  78. package/vendor/modules/plate-painter/exact.d.ts +19 -0
  79. package/vendor/modules/plate-painter/foliage.d.ts +4 -0
  80. package/vendor/modules/plate-painter/gpu.d.ts +65 -0
  81. package/vendor/modules/plate-painter/index.d.ts +14 -0
  82. package/vendor/modules/plate-painter/paint.glsl.d.ts +14 -0
  83. package/vendor/modules/plate-painter/plan.d.ts +42 -0
  84. package/vendor/modules/plate-painter/recipe.d.ts +136 -0
  85. package/vendor/modules/plate-painter/scene.d.ts +4 -0
  86. package/vendor/modules/plate-painter.d.mts +1 -0
  87. package/vendor/modules/plate-painter.inputs.json +50 -0
  88. package/vendor/modules/plate-painter.mjs +384 -0
  89. package/vendor/modules/portrait/body.d.ts +25 -0
  90. package/vendor/modules/portrait/bust.d.ts +67 -0
  91. package/vendor/modules/portrait/cap.d.ts +12 -0
  92. package/vendor/modules/portrait/compile.d.ts +8 -0
  93. package/vendor/modules/portrait/exact.d.ts +17 -0
  94. package/vendor/modules/portrait/hair.d.ts +26 -0
  95. package/vendor/modules/portrait/hand.d.ts +30 -0
  96. package/vendor/modules/portrait/head.d.ts +18 -0
  97. package/vendor/modules/portrait/index.d.ts +12 -0
  98. package/vendor/modules/portrait/mesh.d.ts +24 -0
  99. package/vendor/modules/portrait/parts.d.ts +33 -0
  100. package/vendor/modules/portrait/portrait.glsl.d.ts +4 -0
  101. package/vendor/modules/portrait/render.d.ts +125 -0
  102. package/vendor/modules/portrait/sdf.d.ts +75 -0
  103. package/vendor/modules/portrait/settings.d.ts +27 -0
  104. package/vendor/modules/portrait.d.mts +1 -0
  105. package/vendor/modules/portrait.inputs.json +111 -0
  106. package/vendor/modules/portrait.mjs +2 -0
  107. package/vendor/modules/quality/index.d.ts +130 -0
  108. package/vendor/modules/quality.d.mts +1 -0
  109. package/vendor/modules/quality.inputs.json +34 -0
  110. package/vendor/modules/quality.mjs +2 -0
  111. package/vendor/modules/scene-blend/blend.d.ts +54 -0
  112. package/vendor/modules/scene-blend/blend.glsl.d.ts +8 -0
  113. package/vendor/modules/scene-blend/index.d.ts +25 -0
  114. package/vendor/modules/scene-blend/lit.d.ts +61 -0
  115. package/vendor/modules/scene-blend/noise.d.ts +13 -0
  116. package/vendor/modules/scene-blend/settings.d.ts +63 -0
  117. package/vendor/modules/scene-blend.d.mts +1 -0
  118. package/vendor/modules/scene-blend.inputs.json +133 -0
  119. package/vendor/modules/scene-blend.mjs +2 -0
  120. package/vendor/modules/section-post/index.d.ts +23 -0
  121. package/vendor/modules/section-post/lit.d.ts +47 -0
  122. package/vendor/modules/section-post/noise.d.ts +14 -0
  123. package/vendor/modules/section-post/post.d.ts +31 -0
  124. package/vendor/modules/section-post/post.glsl.d.ts +8 -0
  125. package/vendor/modules/section-post/settings.d.ts +84 -0
  126. package/vendor/modules/section-post.d.mts +1 -0
  127. package/vendor/modules/section-post.inputs.json +107 -0
  128. package/vendor/modules/section-post.mjs +53 -0
  129. package/vendor/modules/surfaces/exact.d.ts +8 -0
  130. package/vendor/modules/surfaces/field.d.ts +7 -0
  131. package/vendor/modules/surfaces/gpu.d.ts +19 -0
  132. package/vendor/modules/surfaces/index.d.ts +17 -0
  133. package/vendor/modules/surfaces/paint.d.ts +28 -0
  134. package/vendor/modules/surfaces/plan.d.ts +39 -0
  135. package/vendor/modules/surfaces/print.d.ts +55 -0
  136. package/vendor/modules/surfaces/recipe.d.ts +143 -0
  137. package/vendor/modules/surfaces/surface.glsl.d.ts +4 -0
  138. package/vendor/modules/surfaces.d.mts +1 -0
  139. package/vendor/modules/surfaces.inputs.json +54 -0
  140. package/vendor/modules/surfaces.mjs +172 -0
  141. package/vendor/modules/tracks/index.d.ts +66 -0
  142. package/vendor/modules/tracks.d.mts +1 -0
  143. package/vendor/modules/tracks.mjs +2 -0
  144. package/vendor/modules/tree-growth/bend.d.ts +28 -0
  145. package/vendor/modules/tree-growth/frame.d.ts +60 -0
  146. package/vendor/modules/tree-growth/index.d.ts +23 -0
  147. package/vendor/modules/tree-growth/light.d.ts +13 -0
  148. package/vendor/modules/tree-growth/math.d.ts +19 -0
  149. package/vendor/modules/tree-growth/model.d.ts +100 -0
  150. package/vendor/modules/tree-growth/sectors.d.ts +10 -0
  151. package/vendor/modules/tree-growth/simulation.d.ts +58 -0
  152. package/vendor/modules/tree-growth/species.d.ts +117 -0
  153. package/vendor/modules/tree-growth/species.data.d.ts +2 -0
  154. package/vendor/modules/tree-growth/year.d.ts +38 -0
  155. package/vendor/modules/tree-growth.d.mts +1 -0
  156. package/vendor/modules/tree-growth.inputs.json +75 -0
  157. package/vendor/modules/tree-growth.mjs +2 -0
  158. package/vendor/modules/tree-render/features.d.ts +9 -0
  159. package/vendor/modules/tree-render/forest/bake.d.ts +41 -0
  160. package/vendor/modules/tree-render/forest/cards.d.ts +28 -0
  161. package/vendor/modules/tree-render/forest/forest.d.ts +156 -0
  162. package/vendor/modules/tree-render/index.d.ts +52 -0
  163. package/vendor/modules/tree-render/inputs.d.ts +260 -0
  164. package/vendor/modules/tree-render/instances.d.ts +66 -0
  165. package/vendor/modules/tree-render/math.d.ts +8 -0
  166. package/vendor/modules/tree-render/tree/bark.d.ts +20 -0
  167. package/vendor/modules/tree-render/tree/leaves.d.ts +29 -0
  168. package/vendor/modules/tree-render/tree/litter.d.ts +21 -0
  169. package/vendor/modules/tree-render/tree/ornaments.d.ts +36 -0
  170. package/vendor/modules/tree-render/tree/roots.d.ts +75 -0
  171. package/vendor/modules/tree-render/tree/shapes.d.ts +49 -0
  172. package/vendor/modules/tree-render/tree/tree.d.ts +239 -0
  173. package/vendor/modules/tree-render/tree/wood.d.ts +27 -0
  174. package/vendor/modules/tree-render/wind.d.ts +51 -0
  175. package/vendor/modules/tree-render.d.mts +1 -0
  176. package/vendor/modules/tree-render.inputs.json +45 -0
  177. package/vendor/modules/tree-render.mjs +2 -0
  178. package/vendor/modules/voxel-dither/dither.glsl.d.ts +9 -0
  179. package/vendor/modules/voxel-dither/index.d.ts +35 -0
  180. package/vendor/modules/voxel-dither/light.d.ts +33 -0
  181. package/vendor/modules/voxel-dither/lit.d.ts +86 -0
  182. package/vendor/modules/voxel-dither/pass.d.ts +46 -0
  183. package/vendor/modules/voxel-dither/screens.d.ts +21 -0
  184. package/vendor/modules/voxel-dither/settings.d.ts +307 -0
  185. package/vendor/modules/voxel-dither/signals.d.ts +35 -0
  186. package/vendor/modules/voxel-dither.d.mts +1 -0
  187. package/vendor/modules/voxel-dither.inputs.json +295 -0
  188. package/vendor/modules/voxel-dither.mjs +452 -0
  189. package/vendor/modules/world-light/index.d.ts +133 -0
  190. package/vendor/modules/world-light.d.mts +1 -0
  191. package/vendor/modules/world-light.inputs.json +68 -0
  192. package/vendor/modules/world-light.mjs +2 -0
@@ -0,0 +1,177 @@
1
+ {
2
+ "pins": {
3
+ "engine": "af034863bceefa8a81bbff8fe64ab36435028c29",
4
+ "modules": "53c36d0eb50798ff9d17f93eae0035449a61f368"
5
+ },
6
+ "sources": {
7
+ "band": {
8
+ "commit": "6d15f0fe55c61534fab88ae1c5ff7aaa5e395329",
9
+ "path": "modules/keel-web3/audio/band"
10
+ }
11
+ },
12
+ "files": {
13
+ "LICENSE": "cabead0e38fc8766f174225e5e9a5c566cc4570676bb0bc31ca23f7af143211a",
14
+ "NOTICE": "bc488bb75d460635e609f33e06c9b12488ab99a235a853dead1c66e1dcea712a",
15
+ "LICENSE-modules": "20ab99c5f70754509473ac38f35be706e66e814ea94c965a777f18f7b2246087",
16
+ "README.md": "fbcde75f850f12946b37794113bcf0950aea7b9e5146d0544a03c38c2d080928",
17
+ "lit.mjs": "5472289de661c3f4ac44211d98a990799572dcd1a7405fdf4432b6f751b391ae",
18
+ "lit.d.mts": "425fdcb99c6d68522f5d9bb5e7d93e9752f37f6b5913f6242fed5f16814f72b0",
19
+ "modules/butterflies.mjs": "b247a76f3bef8a7a51d6cff53cd572e91b8c73701d2c69adc485203928cb551c",
20
+ "modules/butterflies/butterflies.glsl.d.ts": "eb0a7018683d295ce514adb629f137de473a639d172c0116d9db520584cd9e33",
21
+ "modules/butterflies/flight.d.ts": "464916513145b05418d69618cbfe1bd9e06a199fec717cbbaf6d88b21f625970",
22
+ "modules/butterflies/index.d.ts": "f54a1ac64810931ded05a6a5609c7e0d3ffc5c35cc81edf564b15bb23ccc96d4",
23
+ "modules/butterflies/wing.d.ts": "5497f2b3ab9b9e2392cc0a7a789f9c5900e3c5b55072917283651304151174fa",
24
+ "modules/butterflies.d.mts": "87d0830f26bb451254731a3717252e70942ac16640cc9834751f5d7ba3f8932b",
25
+ "modules/butterflies.inputs.json": "9b4b1af830666682286845b4cb27ab8dd8f669021ae2fcac2baa7f08dc4ee100",
26
+ "modules/camera-rail.mjs": "61a29f13088f4c8de49ddc097a61847d85a55c9c9e2c681413d1b9275cb5cf20",
27
+ "modules/camera-rail/index.d.ts": "43689598d9f7fa1b505d5c8854bd3f67edb35a506916342ddf282fb49075a7ed",
28
+ "modules/camera-rail.d.mts": "835d9d9f646e5021f92314e5241761afb89e3d088a4b6c03a5a1a2744b13c09c",
29
+ "modules/device-profile.mjs": "bf49d4b5fb369851bd4f38aea67f39305f4b1853b3bb329fe98c2d6e0f90ba98",
30
+ "modules/device-profile/index.d.ts": "9ceb2bb27c721c45b40d6e98d3913fdc6c1725a5e4830ee31cb271861e1f7338",
31
+ "modules/device-profile.d.mts": "a54e38bacbbc89128a21eda0b702fb269f3130bec8b43842ff66a3b24affca0b",
32
+ "modules/lit-finish.mjs": "13e68b53c45d11af0b54282687786d413c0a5c791f8dcf02e0442f445f1bc5fe",
33
+ "modules/lit-finish/dress.d.ts": "89b60d2878b26ca9259612510434790dcf0e4680cd477a1eead9a0b04d77610c",
34
+ "modules/lit-finish/finish.glsl.d.ts": "853ed7bd72b3058ab1516bd51f6bd5cde2d64881dbb00d3d926139d3b84b2aa5",
35
+ "modules/lit-finish/index.d.ts": "10feb3bf800ee4c4a69678698c1562af6d7f0537edb7e0e07dde900d05dffb3f",
36
+ "modules/lit-finish/lit.d.ts": "67ca943de76f4152ecd121da5b8fc77a477cf75571ad8874c6892cbb24325ec8",
37
+ "modules/lit-finish/pass.d.ts": "cf8d1afebccce4fb8c5ec1c8ce556eaadcf36fa39525037d2aae27f97dd0a36e",
38
+ "modules/lit-finish/settings.d.ts": "d64bbdcd4243e83f0a471248e6afa9b53507c39ba7bf0e7f159cf0aac83cf78e",
39
+ "modules/lit-finish.d.mts": "7af7130d3a46c37af8e965261540cc6b875e6dbab8255a2480762f14c5f20acd",
40
+ "modules/lit-finish.inputs.json": "c677f3eccf8c91696a268df37a459f40dd6e6b278adad47f02fa994c988ee56e",
41
+ "modules/look.mjs": "6541e6cf1476cf5293e55f413125097d8ac00196c0e032126764fd9fd1f22731",
42
+ "modules/look/index.d.ts": "37984dc1fb33d2e5c9b89e289ea5f58e4421058931c5899ec62a9f1b1256654e",
43
+ "modules/look.d.mts": "930d126051eec006a5ad2cf588a07752601114ed701aad429b6f78226062df06",
44
+ "modules/look.inputs.json": "bf8d65f6d6550a844cb7fb5b8df9b5c1fd7bdb0e5ecd498a93b20163a7dd0c6f",
45
+ "modules/motes.mjs": "b54defc1dfa18d81854b5e9bac0736ec4dd943e4435c0b844498b31c97d1561a",
46
+ "modules/motes/index.d.ts": "b712920e9f12eeaba2429e22a5fa98c2160f89decfe4921192c677c225f12943",
47
+ "modules/motes/motes.glsl.d.ts": "c2bc65604b39dac7e4779482cd2bb98edb8558b87d30956edcc35d6934dda1c1",
48
+ "modules/motes/place.d.ts": "9777cc6bf70fdf11f9d95754d2b05ec0dfeec0a1cb868b1842b74a4b91e50232",
49
+ "modules/motes.d.mts": "d31adc2a75d997b84db3b5d50e315384de91029ecb94a4c02e807ac04bd3011a",
50
+ "modules/motes.inputs.json": "9d43962bda63adaa7d4e756b4b8637a89d3b58d818f3c8214766b37ddd91ab32",
51
+ "modules/plate-painter.mjs": "86b5ba7a1aa6ace4489f4ce14dbd58b270ba82c2c223df8b76b3408c637ae72a",
52
+ "modules/plate-painter/dab.d.ts": "85bcc0844ad024a389881f3a29e40a73b6e83ced3e59ec869dc401d9903e7ee5",
53
+ "modules/plate-painter/exact.d.ts": "5cea7cf9987b18b6c1b07c40caec3c40322587f9d4833cc9ca585fb2fa72e764",
54
+ "modules/plate-painter/foliage.d.ts": "192eb6483273acf1f444ae0874011d0ceb9a17309b7ed19c29156522abf09864",
55
+ "modules/plate-painter/gpu.d.ts": "624a90dfa84db1bee6456eb9413aa3e5ca9a0c1d463b966af18182632dcb715b",
56
+ "modules/plate-painter/index.d.ts": "247f4ff2f302c0289d3c58c34b49afc5081dc60f7f219dee03fe745e1d6d39ee",
57
+ "modules/plate-painter/paint.glsl.d.ts": "95d95f5742e07512a8a2a75c76cda4f34b138507abb538233f512357c1d9fc4a",
58
+ "modules/plate-painter/plan.d.ts": "8a02b7260df5bc64ebec669c2fd98b6249c689af4a79ecb2a0651733b63b9ec2",
59
+ "modules/plate-painter/recipe.d.ts": "f9a275945f5446c9d4d25a7f6397f6d7cd2ea547de7ccfa3a88dc59ccf57f4d2",
60
+ "modules/plate-painter/scene.d.ts": "1cb0817646de6de396531acde0289c4018d89d7ccf1fa3980585acb836c04d06",
61
+ "modules/plate-painter.d.mts": "5cdd609110a0ef64be69a9f268007057b989ff937afa0a972ff3a54c264e4538",
62
+ "modules/plate-painter.inputs.json": "b5edd16ed5a7cd7eb9dd7699b87bf5b342d08f6bb3e88cbd254aa25554e4cb48",
63
+ "modules/portrait.mjs": "5d792cceab1b047496de1aff41ea5595b027ce8878595a04dff653ff498a7ce1",
64
+ "modules/portrait/body.d.ts": "e30dc54613f68047f863e0bca98a9e75fa3112742f7f9d32a92343dc2c49485c",
65
+ "modules/portrait/bust.d.ts": "0b1bc1671f4515c2dcd87211ded9fa9597b41fe3cf11b4327d0bb3fb4a11a66b",
66
+ "modules/portrait/cap.d.ts": "46b74b26fb2ea63660fcd958cfc6644b00085492a1e5fdc3ab47fe2362041bde",
67
+ "modules/portrait/compile.d.ts": "0e8cf65e2f2da9da3a6bcc48f0185bef44ac8b9602666c467a965825430f329f",
68
+ "modules/portrait/exact.d.ts": "01140b66e40c222fc4b56cb943fc6b9959b7dcc3defa617d2d4f822ab6a113d6",
69
+ "modules/portrait/hair.d.ts": "89500c6e221fb9ba8844b378b55378965d9488b82e05a110d136f6d321444b8b",
70
+ "modules/portrait/hand.d.ts": "4c94f90a9f535f2779981a09967ede04e0dd05083b0c93aeaf84bdb01086c49f",
71
+ "modules/portrait/head.d.ts": "5f29b643f71fa8f2eedcb4d9e0a48d147508a5fb30a56d189f71ee34d2c12843",
72
+ "modules/portrait/index.d.ts": "cb45a580b82dd35e8813201df7a1b4368a9a1a4315435f8c63085b84316f2919",
73
+ "modules/portrait/mesh.d.ts": "11eaf1c8056f620a9602570d8ca5072ecbf44661562e888fc59bbeb69318572f",
74
+ "modules/portrait/parts.d.ts": "aaa06f70ff583e4cb630115beb9757b06ac724232d0791c2ff470efde3e05949",
75
+ "modules/portrait/portrait.glsl.d.ts": "e15f6dc014f69a120b7476a383ea08ac44d20787fd306b59a8a4dab07154e653",
76
+ "modules/portrait/render.d.ts": "ba248a17d727c2d5cf5a9058bb950c85e0c32057b1d425090679eda86b3165fb",
77
+ "modules/portrait/sdf.d.ts": "6f01bc60c450284ab364edf95113adbe18ba05d5d9800e03a4523236867651ee",
78
+ "modules/portrait/settings.d.ts": "5862dba6030185c01340ec7aebb1247cfd449f4a037eb24ac8c6bbde841b3025",
79
+ "modules/portrait.d.mts": "68840438bee66f767aacfc343878398a98f0dbe5d6bfa0d6c0e7531725156f5f",
80
+ "modules/portrait.inputs.json": "3759a35ef4d949c6de18392d12844c1bbe497befccb809d4856961d383257d5b",
81
+ "modules/quality.mjs": "85bb1daece2a59e92971d4b085604bef667213b5fb985be981f91e32c47eb285",
82
+ "modules/quality/index.d.ts": "093f055e261cfe557d8f8745d9f8bbd32e04491309447733a40ded25ecc981f1",
83
+ "modules/quality.d.mts": "5f3fc3b745295ddbb0b9b8e32f2a2fbacdc11db9b9b88d6aae0b544c19ddab0e",
84
+ "modules/quality.inputs.json": "24874fa69b3e627eeb816137788f1b0dbf85a07b8325b6f8549691eb81b0d5bd",
85
+ "modules/scene-blend.mjs": "d0410e38b82147baca0e1d0f912c0e2b0ee797e488793e289f85de48a634fa03",
86
+ "modules/scene-blend/blend.d.ts": "a64d75b4a554d7d6e97ce12f3bfced575ef8c16c923677ef9c0a98594688f2d7",
87
+ "modules/scene-blend/blend.glsl.d.ts": "06c610b3ef1ddd2f45fd064647675d2c75995e0addb3d1022e0c7b009425998e",
88
+ "modules/scene-blend/index.d.ts": "ef67e690d1b5640fd59e3b9b787fe38d224393c180b315abc6306530beb1aaad",
89
+ "modules/scene-blend/lit.d.ts": "1c08961a3eb6f846dd3a55f11234bc958211987677376f2ce9a5f4c43f941168",
90
+ "modules/scene-blend/noise.d.ts": "430acd9ce076ff674ed15a07d79564aa89e465580769e80d8b20fabd0a7ab47e",
91
+ "modules/scene-blend/settings.d.ts": "9b19e56fffd1239154b192f4b511e86a1cce1cacca7eed5872bfdf10dcbf2270",
92
+ "modules/scene-blend.d.mts": "965cdc2d42c0ad132e3d386b2fd31f389fd4dff9f0307df6d5624cca07f56d76",
93
+ "modules/scene-blend.inputs.json": "93e20e11d11ab4e7dcf607ada7412b463659a170c1c4d5df3278800c9bfa5226",
94
+ "modules/section-post.mjs": "37557e1cd9beb5b4d9b4e475203b9481ca60cdfa40eafa403e2e1a6850f475fa",
95
+ "modules/section-post/index.d.ts": "3d2c229d6df3422e582367d5cf1abf653fb171f3274cc5b5fef03f33d76d6b10",
96
+ "modules/section-post/lit.d.ts": "0eabb1a53d1a0925d78f2468a305f121dd366f42b2cc50ea285f98c0dd2d73a1",
97
+ "modules/section-post/noise.d.ts": "a13c3182628e8f3f77c505fc8db1a8fb0005b8d8689c505f71c102a973ade2b4",
98
+ "modules/section-post/post.d.ts": "5a9c4836009b30817d30b7fb69950780514ffa526c9ad16445d1bce7f47e5b2b",
99
+ "modules/section-post/post.glsl.d.ts": "bb01833d6f2b6be9a3c1bc1a3bb841c60be931b504b35161e8ee6a693331f13c",
100
+ "modules/section-post/settings.d.ts": "249fa5e26afc021ee04996c8520110e701bf736f4e72202f1e78d12c00f6d307",
101
+ "modules/section-post.d.mts": "38c0f6134c1023d330daff94fded71e9b4b3e7b8a76716a9aabcecfc7570f758",
102
+ "modules/section-post.inputs.json": "8fa8ac2eb8d45dfdb4d277c71617980cccfb389916066c4f0f5301b42012d3af",
103
+ "modules/surfaces.mjs": "22c158faa2ff8810acb55ae7fea0cac145f332ce9aba19d35219cd2a2da407a7",
104
+ "modules/surfaces/exact.d.ts": "ebbabf228fa6e47bee72fbb4c920b8d3097cb30ccda87baa910897f4d49d500c",
105
+ "modules/surfaces/field.d.ts": "2c9483d352137ffa7e88ee255d4cb709289cc3254d4bf6d6b77cd6850ed573f0",
106
+ "modules/surfaces/gpu.d.ts": "6d190fa4859cdaa002763fc4d6b6b5e80d5874c964f51744afa8536044ff5539",
107
+ "modules/surfaces/index.d.ts": "bbc3dd34228fa87b6c8b790539c535417849bc0e67da049b0a960b65b714d0db",
108
+ "modules/surfaces/paint.d.ts": "c1d2b22c41d15224c3bc58f01fe6afa499fae2b9987b61255874d85c9a9f70bb",
109
+ "modules/surfaces/plan.d.ts": "3fc646a35adcf999469d314d5e7122962f8e4c5933f91c81721ef96d852905a4",
110
+ "modules/surfaces/print.d.ts": "23eb14db2d44db32a5141b118805ee5e1352e7d567b25917935d187ffef4c699",
111
+ "modules/surfaces/recipe.d.ts": "c87a171de525badbb50ec86e8366c26860ff870fe104b363a7a6d71032cf8254",
112
+ "modules/surfaces/surface.glsl.d.ts": "616fc2d94afd764b16f150135692c97cc6e5dee790b15600f275acb2f0df7db4",
113
+ "modules/surfaces.d.mts": "15d853e787270d5ee76c812e0241e6a7a4aac99899b02f7fad3dadb9f55a5342",
114
+ "modules/surfaces.inputs.json": "131c2826dfd7f3c67553da0741e6d2498334aeb15c22ca1c4d8769b56dba2278",
115
+ "modules/tracks.mjs": "a949fe9ca27e954e4fad9bc28900e089fff94a7b963bc9a987e187be7c9fd756",
116
+ "modules/tracks/index.d.ts": "18b8eb834cc1b20f9fb46c7f77c3036d02e91fbebf88018440a24d1639926f07",
117
+ "modules/tracks.d.mts": "76bc9248c016d5e39d356de203d4d081249c82ecb34109476560f8c7d96d16d4",
118
+ "modules/tree-growth.mjs": "8511d7a43c9a552ecb9e41a8abecda7f5dbc884d1658fec080bea64e1a1a6614",
119
+ "modules/tree-growth/bend.d.ts": "e20c2fb07d78ec9dcddcfbf33e7d0710c874359c1de2e4dd085c8835c8b7c437",
120
+ "modules/tree-growth/frame.d.ts": "0ce6002ca829980785364b86ea0a40c89554dd3208641f34b98b94b48f886358",
121
+ "modules/tree-growth/index.d.ts": "633bc0f9dcc77ccecd483092c3d62031588d29bd11d00dd95167f2a17d241e09",
122
+ "modules/tree-growth/light.d.ts": "3d40427750159828ad8d5ed46834d47e2c438db0046bf8023fd92ed199af104f",
123
+ "modules/tree-growth/math.d.ts": "02ac18956adaa44ca528cfd47b6df5da799648949f3e10b0dd489561119edfcf",
124
+ "modules/tree-growth/model.d.ts": "f6068d6cdb2f2f6a20315cffabb5e2cfaa197d6a8f5b2e246aa7430048aa6e1a",
125
+ "modules/tree-growth/sectors.d.ts": "6334ca6c4f808db0aae88223a406156b187ecea44964f11d2a849623ad8edbf4",
126
+ "modules/tree-growth/simulation.d.ts": "36d5b816201c29fb84cebf1be4b8092b9676355aeedeffb27c4f9d7b803f0135",
127
+ "modules/tree-growth/species.d.ts": "6277035e31bd84a2f32bdda83b204726243995848ce54ee5e77b8adc5613841d",
128
+ "modules/tree-growth/species.data.d.ts": "75886b95504b862097ddedc59ce6390dee7932624bad66267e9c1a1f1e96b74c",
129
+ "modules/tree-growth/year.d.ts": "8976250634c5f7a946e5459b3c7477d3a274c1fab74808353341945781f10aae",
130
+ "modules/tree-growth.d.mts": "ac3e20fe301bf58d65ae31c3ecd65a1a0aec2662a230582ae48495d1b9a6f18c",
131
+ "modules/tree-growth.inputs.json": "a646d9a8173262a60a5ca2c4c2cb13495f829d3dc2bd0b7d737c8ae098a17c7e",
132
+ "modules/tree-render.mjs": "6d8d50f58a73d6434f6b4a872a63b679a0909acb30a809cafebd3b049160607f",
133
+ "modules/tree-render/features.d.ts": "87d9e67a8f700fbc7174df44743a2f873f3955bf4dafc586d5eff61f7af74d41",
134
+ "modules/tree-render/forest/bake.d.ts": "c560ae867fa40f7863f889aa802da5440b3065d7e0ff4f67aad0ee4e0bfc1919",
135
+ "modules/tree-render/forest/cards.d.ts": "6af5f70848670715aa042a51632926aa277a93e0f53d349fdcef4d540f42d1e6",
136
+ "modules/tree-render/forest/forest.d.ts": "8c49cf1977eead9169100acbe481d8f073be29010121f6f1c2872b274efc9692",
137
+ "modules/tree-render/index.d.ts": "f76d5bf00c8fd1b44bded5a0b6da4ea22c07ca678fb9b135cb41d4581ef46ee2",
138
+ "modules/tree-render/inputs.d.ts": "622be3106937b3eab441d5e136bdebe5db7be128e18f9ce5130111f911cbcbc2",
139
+ "modules/tree-render/instances.d.ts": "b7ba8401b1903e699b8330e10e2aedfc4c55266b7eab174ce3241111b484e234",
140
+ "modules/tree-render/math.d.ts": "a95f59c702a1db8c3891380b2639cde64b82843a94f55268149a6af0f7d0eae5",
141
+ "modules/tree-render/tree/bark.d.ts": "c7cd99770181a7b5fdf4794e319eeb2a28012cb0b49aee428b0577e3e7da9a0a",
142
+ "modules/tree-render/tree/leaves.d.ts": "33e930310b3338d60929611697cb92198964c588f2600a83477d5a571a1f126f",
143
+ "modules/tree-render/tree/litter.d.ts": "497c1b1d1bd0d16d310aeafc948cfddb281ba227fc96a12d6d4e6e648af07f00",
144
+ "modules/tree-render/tree/ornaments.d.ts": "8b6745a6d0b72dda35274629d780be0ef4cb38b9cb81314c4962bd525a377ca7",
145
+ "modules/tree-render/tree/roots.d.ts": "b07bffbbd64112159567c9ac74a440e54521afcdbfc202c24bd8cdf2287ce2f5",
146
+ "modules/tree-render/tree/shapes.d.ts": "5da152537f67da7730c0bc8eeaadacd04d082413e0a71225feafca136cb7a280",
147
+ "modules/tree-render/tree/tree.d.ts": "9688ad7436b6c7f0bb25105a5c8a5b60034f0dabac46ff197b5373518b0acf3e",
148
+ "modules/tree-render/tree/wood.d.ts": "6187c1f900a78837e021826b36683afc5feb481847471fbb30c239f257cb5e24",
149
+ "modules/tree-render/wind.d.ts": "d65c7e38a0dc627b8b7a397f9b3d050b4260de016f069c4e098238b448d22ee4",
150
+ "modules/tree-render.d.mts": "da3d3435410962b2a7863fb6f69cd9767817e4ddd1838645cb3f4a741dac30ea",
151
+ "modules/tree-render.inputs.json": "e689fc2afcc92b80a9a2a6f0dea4bdd50599251ff04bccca4c2eaba61aa6a7bb",
152
+ "modules/voxel-dither.mjs": "d8cbb42c93e9808279af6624299359d8e2e61e26a6ec11640d7293c485f01c55",
153
+ "modules/voxel-dither/dither.glsl.d.ts": "c82e57042a16a7917d0164d8c77e9b849a7c61a179b7b88290af2c0667b19c57",
154
+ "modules/voxel-dither/index.d.ts": "63605ce4bff39803f6e5d63283112b49375b089f01b057d8c9dcd0538d3ea598",
155
+ "modules/voxel-dither/light.d.ts": "b9de60f023c752a71e6ebd9f33b30f62cde898032a6fcc483123114f91ee2aa2",
156
+ "modules/voxel-dither/lit.d.ts": "153af9bc9d4e4282c7322d13093caf09702f8efade51753d569bd5e4299f9958",
157
+ "modules/voxel-dither/pass.d.ts": "a0b3e2483ac4daf872f049297176ab5568b7e7686b98a6654532af31b0ff5ed0",
158
+ "modules/voxel-dither/screens.d.ts": "65e6a57f06442715a33bb22d50c6d95e2001b21cb6598c9680147f8f5e76e7cc",
159
+ "modules/voxel-dither/settings.d.ts": "ccf5bdee8017c96deaf20e87b47e9f19804a0988226dd1e52a9474c906f9a283",
160
+ "modules/voxel-dither/signals.d.ts": "4a3dbe8f5ce6490a4693a5f0337ed791ae57be32e523132c260de65e00eab75b",
161
+ "modules/voxel-dither.d.mts": "31ba5c0803fca1840e510e96a467c65a686098fb196250d29e5e81075cbf4c50",
162
+ "modules/voxel-dither.inputs.json": "9973a6122cdf8f689f965d0df6ee1a09383eaecdf72210ee5cd869372de49977",
163
+ "modules/world-light.mjs": "26c4b9297d503f356e9314d7180e77a6b730f1a0a34b59ec1f15328634eea584",
164
+ "modules/world-light/index.d.ts": "ddd98a091925b9c71f1eb0f3ff746f500261bc9ad61caf36dcfd7ce3359b6c16",
165
+ "modules/world-light.d.mts": "8691b6a2f5939aa7bdb1b9cebc5822ae41842449798a7d4f6dd4a4e866703b02",
166
+ "modules/world-light.inputs.json": "2b5bdc402128c3610168bbf3708adcef239e12241a0931da0118c3faa833c557",
167
+ "modules/band.mjs": "f762892f5871786cebcd851c150b34ab9889bf7c0ab2da2f3be79ac3df7c36e3",
168
+ "modules/band/events.d.ts": "bdeece94aea9d6e0c2b324066345ff52b6693a469ebc1729e7f6055f2b807789",
169
+ "modules/band/index.d.ts": "fb2d6bb4f599677e7b9186b3ac88957ec482de059a24e1b6296f450013bf3a47",
170
+ "modules/band/player.d.ts": "469a57ff849af1dfb00ce4fffb242f7028437a524e3b4d9fe31c0c947ba9a068",
171
+ "modules/band/roll.d.ts": "89ac8d1541d1e85cd0b52d6cab2b3ab88f00acec4d22bd25f891dbf4c91087f3",
172
+ "modules/band/score.d.ts": "f10ded38d2e124684f0c1de128a66c4a040e935682a197535d7f64eb51f25f8a",
173
+ "modules/band/styles.data.d.ts": "dcc55215419b37e537577e78605d00e40678d279613a5fa3d671db01dc5d8dd0",
174
+ "modules/band/voices.d.ts": "4c80f70d99a9c991ef13df95dd6a598a6c7bdf15dea55ecb972c394a6841a808",
175
+ "modules/band.d.mts": "30e89496eecff11a48c24e14b6493de1423dc16e790311a6c4a59bc3263ca8d6"
176
+ }
177
+ }
@@ -0,0 +1,20 @@
1
+ import type { Score } from "./score.js";
2
+ import type { Part } from "./styles.data.js";
3
+ /** One note or hit: its part, MIDI note (0 for drums), length in steps and loudness (0 to 1). */
4
+ export interface BandEvent {
5
+ readonly part: Part;
6
+ readonly note: number;
7
+ readonly length: number;
8
+ readonly gain: number;
9
+ }
10
+ /** The parts playing at an energy: they join in the style's order, the first from silence up. */
11
+ export declare function partsAt(score: Score, energy: number): Part[];
12
+ /**
13
+ * The events that start on a step.
14
+ *
15
+ * @param score From scoreOf.
16
+ * @param step Sixteenth notes since the start, from 0.
17
+ * @param energy 0 to 1: how many of the style's parts play. Default 1, the whole band.
18
+ * @returns The notes and hits, in no particular order.
19
+ */
20
+ export declare function eventsAt(score: Score, step: number, energy?: number): BandEvent[];
@@ -0,0 +1,29 @@
1
+ /**
2
+ * band: a seeded generative band on plain Web Audio. MIT.
3
+ *
4
+ * One seed gives a whole piece in one of eight styles: a key and mode, a chord
5
+ * progression, drum and bass rows and a lead that phrases and rests. Parts join
6
+ * in as an energy dial rises, so a host can tie the music to a scroll, a level
7
+ * or a mood. No audio library and no samples: every sound is a few oscillators,
8
+ * a filter and an envelope.
9
+ *
10
+ * const band = createBand(audioContext);
11
+ * band.start(scoreOf({ seed: "grove", style: "dream" }));
12
+ * band.setEnergy(0.4); // fewer parts
13
+ * band.setScore(scoreOf({ seed: 9 })); // a new piece at the next bar line
14
+ *
15
+ * `scoreOf` and `eventsAt` are pure and touch no audio, so a renderer, a test
16
+ * or a visual can read what plays at any sixteenth note. `band.schedule` writes
17
+ * a stretch into an OfflineAudioContext for a rendered loop.
18
+ */
19
+ export { seedNumber } from "./roll.js";
20
+ export { MODES, STYLE_NAMES, STYLES } from "./styles.data.js";
21
+ export type { Comp, ModeName, Part, Style, StyleName, Timbre } from "./styles.data.js";
22
+ export { STEPS_PER_BAR, noteOf, scoreOf } from "./score.js";
23
+ export type { BandInput, Chord, Score } from "./score.js";
24
+ export { eventsAt, partsAt } from "./events.js";
25
+ export type { BandEvent } from "./events.js";
26
+ export { drum, strike } from "./voices.js";
27
+ export type { DrumRig, Hit } from "./voices.js";
28
+ export { createBand } from "./player.js";
29
+ export type { Band, BandOptions, ScheduleOptions } from "./player.js";
@@ -0,0 +1,43 @@
1
+ import type { Score } from "./score.js";
2
+ /** Options for `createBand`. */
3
+ export interface BandOptions {
4
+ /** Where the band plays. Default: the context's destination. */
5
+ readonly destination?: AudioNode;
6
+ /** Master level, 0 to 1. Default 0.8. */
7
+ readonly gain?: number;
8
+ /** How far ahead of the sound notes are scheduled, in seconds. Default 0.15. */
9
+ readonly lookahead?: number;
10
+ }
11
+ /** What `schedule` writes: how many steps, from which step, starting when, at what energy. */
12
+ export interface ScheduleOptions {
13
+ readonly steps: number;
14
+ readonly from?: number;
15
+ readonly at?: number;
16
+ readonly energy?: number;
17
+ }
18
+ /** A band bound to one audio context. */
19
+ export interface Band {
20
+ /** The master gain node, for a host that wants to meter or route it. */
21
+ readonly output: AudioNode;
22
+ /** The next step to be scheduled, in sixteenths from the start. */
23
+ readonly step: number;
24
+ readonly playing: boolean;
25
+ /** Starts the score from the top. The context must be running (start it from a tap or key). */
26
+ start(score: Score, energy?: number): void;
27
+ /** Changes score at the next bar line, keeping time. */
28
+ setScore(score: Score): void;
29
+ /** How much of the band plays, 0 to 1, from the next step: tie it to a scroll, a level, a mood. */
30
+ setEnergy(energy: number): void;
31
+ /** Fades the master level over `seconds` (default 0.3). */
32
+ setGain(gain: number, seconds?: number): void;
33
+ /** Writes a stretch of the score into the context at once, for an OfflineAudioContext. Returns its end time. */
34
+ schedule(score: Score, options: ScheduleOptions): number;
35
+ stop(): void;
36
+ }
37
+ /**
38
+ * Makes a band on an audio context. It makes no sound until `start`.
39
+ *
40
+ * @param ctx An AudioContext, or an OfflineAudioContext for `schedule`.
41
+ * @param options The destination, level and lookahead.
42
+ */
43
+ export declare function createBand(ctx: BaseAudioContext, options?: BandOptions): Band;
@@ -0,0 +1,14 @@
1
+ /** Seeded randomness for the band: one hash, one generator, one safe list read. MIT. */
2
+ /** A 32-bit number for any seed: a number is used as it is, text is hashed. */
3
+ export declare function seedNumber(seed: number | string): number;
4
+ /** Mixes whole numbers into one 32-bit hash, so a seed, a bar and a part give their own stream. */
5
+ export declare function mixHash(...parts: readonly number[]): number;
6
+ /** A number in [0, 1) for a hash, the same every time. */
7
+ export declare const unit: (hash: number) => number;
8
+ /** A generator of numbers in [0, 1) from a seed (mulberry32). */
9
+ export declare function random(seed: number): () => number;
10
+ /** The item at an index, wrapped round the list. Throws on an empty list. */
11
+ export declare function at<T>(list: readonly T[], index: number): T;
12
+ /** The item a roll in [0, 1) lands on. */
13
+ export declare const pick: <T>(list: readonly T[], roll: number) => T;
14
+ export declare const clamp: (value: number, min: number, max: number) => number;
@@ -0,0 +1,45 @@
1
+ import type { ModeName, Style, StyleName } from "./styles.data.js";
2
+ export declare const STEPS_PER_BAR = 16;
3
+ /** What a host asks for. Only the seed is needed; anything left out is the seed's choice. */
4
+ export interface BandInput {
5
+ readonly seed: number | string;
6
+ readonly style?: StyleName;
7
+ /** Beats per minute, 40 to 200. */
8
+ readonly tempo?: number;
9
+ /** The key note as a pitch class, 0 (C) to 11 (B). */
10
+ readonly key?: number;
11
+ readonly mode?: ModeName;
12
+ }
13
+ /** One bar's chord: its scale degree, the bass note and the notes the chord part plays, as MIDI numbers. */
14
+ export interface Chord {
15
+ readonly degree: number;
16
+ readonly root: number;
17
+ readonly notes: readonly number[];
18
+ }
19
+ /** Everything fixed for a piece. `eventsAt` reads what plays at any step from it. */
20
+ export interface Score {
21
+ readonly seed: number;
22
+ readonly style: StyleName;
23
+ readonly sound: Style;
24
+ readonly tempo: number;
25
+ readonly swing: number;
26
+ readonly key: number;
27
+ readonly mode: ModeName;
28
+ /** One chord per bar; the form repeats. */
29
+ readonly chords: readonly Chord[];
30
+ readonly kick: string;
31
+ readonly snare: string;
32
+ readonly hat: string;
33
+ readonly bass: string;
34
+ /** The lead's contour: eight steps along the scale, relative to the bar's chord. */
35
+ readonly motif: readonly number[];
36
+ }
37
+ /** The MIDI note of a scale degree (any whole number; it runs on through the octaves) above a base note. */
38
+ export declare function noteOf(mode: ModeName, base: number, degree: number): number;
39
+ /**
40
+ * The score for a seed: the same input always gives the same piece.
41
+ *
42
+ * @param input The seed, and any of style, tempo, key and mode to pin.
43
+ * @returns The piece's tempo, key, chords, drum and bass rows and lead contour.
44
+ */
45
+ export declare function scoreOf(input: BandInput): Score;
@@ -0,0 +1,37 @@
1
+ /** The band's styles and scales, as data. A style is a row: change a row, or add one, and the band plays it. MIT. */
2
+ export type Part = "kick" | "snare" | "hat" | "bass" | "chord" | "lead";
3
+ export type Timbre = "soft" | "keys" | "pluck" | "pad" | "bell" | "saw" | "square" | "sub";
4
+ export type ModeName = "major" | "minor" | "dorian" | "mixolydian" | "lydian" | "phrygian";
5
+ /** How the chord part plays its chord: held, stabbed, pulsed in eighths, or broken into single notes. */
6
+ export type Comp = "pad" | "stab" | "pulse" | "arp";
7
+ /** Semitones of each scale degree above the key note. */
8
+ export declare const MODES: Readonly<Record<ModeName, readonly number[]>>;
9
+ /**
10
+ * One style. Drum rows are sixteen steps: `x` a hit, `o` a soft hit, `.` a rest. The bass row reads `r` root,
11
+ * `5` fifth, `o` octave, `.` rest. Progressions are scale degrees from 0, one per bar.
12
+ */
13
+ export interface Style {
14
+ readonly tempo: readonly [number, number];
15
+ /** How late the off sixteenths fall, as a share of a step. */
16
+ readonly swing: number;
17
+ readonly modes: readonly ModeName[];
18
+ readonly progressions: readonly (readonly number[])[];
19
+ /** Chance a chord takes a seventh. */
20
+ readonly sevenths: number;
21
+ readonly kick: readonly string[];
22
+ readonly snare: readonly string[];
23
+ readonly hat: readonly string[];
24
+ readonly bass: readonly string[];
25
+ readonly comp: Comp;
26
+ /** Share of eighth notes the lead plays. */
27
+ readonly lead: number;
28
+ readonly voices: Readonly<Record<"chord" | "bass" | "lead", Timbre>>;
29
+ /** Reverb and echo sends, 0 to 1. */
30
+ readonly space: number;
31
+ readonly echo: number;
32
+ /** The order parts join in as energy rises. */
33
+ readonly layers: readonly Part[];
34
+ }
35
+ export type StyleName = "ambient" | "lofi" | "synthwave" | "chiptune" | "house" | "cinematic" | "folk" | "dream";
36
+ export declare const STYLES: Readonly<Record<StyleName, Style>>;
37
+ export declare const STYLE_NAMES: StyleName[];
@@ -0,0 +1,33 @@
1
+ /** The band's instruments, on plain Web Audio: a few oscillators, a filter and an envelope each. MIT. */
2
+ import type { Timbre } from "./styles.data.js";
3
+ /** One sounding note: when it starts, its pitch, how long it is held and how loud (0 to 1). */
4
+ export interface Hit {
5
+ readonly time: number;
6
+ readonly frequency: number;
7
+ readonly seconds: number;
8
+ readonly gain: number;
9
+ }
10
+ /**
11
+ * Plays one note of a timbre into `out`.
12
+ *
13
+ * @param ctx The audio context, live or offline.
14
+ * @param out Where the note goes.
15
+ * @param timbre Which instrument.
16
+ * @param hit When, what pitch, how long and how loud.
17
+ */
18
+ export declare function strike(ctx: BaseAudioContext, out: AudioNode, timbre: Timbre, hit: Hit): void;
19
+ /** What a drum needs: the context, where it goes and the noise it is cut from. */
20
+ export interface DrumRig {
21
+ readonly ctx: BaseAudioContext;
22
+ readonly out: AudioNode;
23
+ readonly noise: AudioBuffer;
24
+ }
25
+ /**
26
+ * Plays one drum hit.
27
+ *
28
+ * @param rig The context, the output and a buffer of white noise.
29
+ * @param part Which drum.
30
+ * @param time When it lands.
31
+ * @param gain How hard, 0 to 1.
32
+ */
33
+ export declare function drum(rig: DrumRig, part: "kick" | "snare" | "hat", time: number, gain: number): void;
@@ -0,0 +1 @@
1
+ export * from './band/index.js'
@@ -0,0 +1,2 @@
1
+ // band from keel-modules 6d15f0f (MIT), built from source. Generated: don't edit.
2
+ function v(n){if(typeof n=="number")return n>>>0;let r=2166136261;for(let e=0;e<n.length;e+=1)r=Math.imul(r^n.charCodeAt(e),16777619);return r>>>0}function x(...n){let r=2654435769;for(let e of n)r=Math.imul(r^e>>>0,2246822507),r=Math.imul(r^r>>>13,3266489909),r^=r>>>16;return r>>>0}var S=n=>(x(n,1374496523)>>>0)/4294967296;function g(n){let r=n>>>0;return()=>{r=r+1831565813>>>0;let e=r;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function m(n,r){let e=n.length,t=n[(Math.floor(r)%e+e)%e];if(t===void 0)throw new RangeError("Empty list.");return t}var y=(n,r)=>m(n,Math.min(n.length-1,r*n.length)),p=(n,r,e)=>Math.min(e,Math.max(r,n));var T={major:[0,2,4,5,7,9,11],minor:[0,2,3,5,7,8,10],dorian:[0,2,3,5,7,9,10],mixolydian:[0,2,4,5,7,9,10],lydian:[0,2,4,6,7,9,11],phrygian:[0,1,3,5,7,8,10]},k={ambient:{tempo:[56,72],swing:0,modes:["lydian","major","dorian"],progressions:[[0,3,0,4],[0,5,3,4],[0,2,3,0],[3,0,4,0]],sevenths:.8,kick:["................"],snare:["................"],hat:["..........o.....","......o........."],bass:["r...............","r.......5......."],comp:"pad",lead:.16,voices:{chord:"pad",bass:"sub",lead:"bell"},space:.85,echo:.5,layers:["chord","bass","lead","hat","kick","snare"]},lofi:{tempo:[68,86],swing:.2,modes:["dorian","major","minor"],progressions:[[1,4,0,5],[0,5,1,4],[3,4,2,5],[0,3,1,4]],sevenths:1,kick:["x.....x...x.....","x......x..x.....","x.........x..o.."],snare:["....x.......x...","....x.......x..o"],hat:["x.x.x.x.x.x.x.x.","x.xox.x.x.xox.x."],bass:["r.....r...5.....","r..r......o.....","r.........r..5.."],comp:"stab",lead:.3,voices:{chord:"keys",bass:"sub",lead:"pluck"},space:.4,echo:.25,layers:["chord","hat","kick","bass","snare","lead"]},synthwave:{tempo:[92,116],swing:0,modes:["minor","dorian"],progressions:[[0,5,2,6],[0,6,5,6],[5,6,0,0],[0,2,5,4]],sevenths:.2,kick:["x...x...x...x..."],snare:["....x.......x...","....x.......x.x."],hat:["..x...x...x...x.","x.x.x.x.x.x.x.x."],bass:["r.r.r.r.r.r.r.r.","r.r.o.r.r.r.o.r."],comp:"arp",lead:.4,voices:{chord:"saw",bass:"saw",lead:"saw"},space:.5,echo:.45,layers:["bass","kick","chord","snare","hat","lead"]},chiptune:{tempo:[120,156],swing:0,modes:["major","mixolydian","minor"],progressions:[[0,4,5,3],[0,3,4,4],[0,5,3,4],[5,3,0,4]],sevenths:0,kick:["x...x...x...x...","x.....x.x...x..."],snare:["....x.......x...","....x..x....x..."],hat:["x.x.x.x.x.x.x.x."],bass:["r.o.r.o.r.o.r.o.","r..r..5.r..r..5."],comp:"arp",lead:.6,voices:{chord:"square",bass:"square",lead:"square"},space:.08,echo:.2,layers:["lead","bass","chord","kick","snare","hat"]},house:{tempo:[118,126],swing:.06,modes:["minor","dorian","mixolydian"],progressions:[[0,0,5,6],[0,3,0,4],[0,6,5,3],[0,0,3,3]],sevenths:.7,kick:["x...x...x...x..."],snare:["....x.......x...","....x.......x..o"],hat:["..x...x...x...x.","o.x.o.x.o.x.o.x."],bass:["..r...r...r...r.","..r..r....r..o.."],comp:"stab",lead:.25,voices:{chord:"keys",bass:"sub",lead:"pluck"},space:.35,echo:.35,layers:["kick","hat","bass","chord","snare","lead"]},cinematic:{tempo:[62,84],swing:0,modes:["minor","phrygian","dorian"],progressions:[[0,5,3,4],[0,2,5,6],[0,6,5,4],[0,3,5,4]],sevenths:.3,kick:["x.......x.......","x.....x.x......."],snare:["............x...","........x...x.x."],hat:["................"],bass:["r...............","r.......r......."],comp:"pulse",lead:.22,voices:{chord:"pad",bass:"sub",lead:"soft"},space:.75,echo:.3,layers:["chord","bass","kick","lead","snare","hat"]},folk:{tempo:[84,110],swing:.12,modes:["major","mixolydian","dorian"],progressions:[[0,3,0,4],[0,4,5,3],[0,0,3,4],[5,3,0,4]],sevenths:.1,kick:["x.......x.......","x.....x.x......."],snare:["....o.......o...","................"],hat:["..o...o...o...o."],bass:["r.......5.......","r.....5.r.....5."],comp:"arp",lead:.45,voices:{chord:"pluck",bass:"sub",lead:"soft"},space:.3,echo:.15,layers:["chord","bass","lead","kick","hat","snare"]},dream:{tempo:[74,96],swing:.08,modes:["lydian","major","mixolydian"],progressions:[[0,4,5,3],[3,0,4,5],[0,2,3,3],[0,5,3,4]],sevenths:.9,kick:["x.........x.....","x.......x......."],snare:["....o.......x...","............x..."],hat:["x.o.x.o.x.o.x.o.","..x...x...x...x."],bass:["r.........r.....","r.......5.....o."],comp:"pulse",lead:.35,voices:{chord:"bell",bass:"sub",lead:"soft"},space:.7,echo:.55,layers:["chord","lead","bass","hat","kick","snare"]}},A=Object.keys(k);var f=16;function h(n,r,e){let t=T[n];return r+Math.floor(e/t.length)*12+m(t,e)}var N=(n,r)=>r+((n-r)%12+12)%12;function L(n,r,e,t){let o=(t?[0,2,4,6]:[0,2,4]).map(s=>N(h(n,r,e+s),55)).sort((s,c)=>s-c);return{degree:e,root:N(h(n,r,e),36),notes:o}}function H(n){let r=[0],e=0;for(let t=1;t<7;t+=1)e=p(e+Math.round(n()*4-2),-3,5),r.push(e);return r.push(n()<.5?2:0),r}function V(n){let r=v(n.seed),e=g(x(r,1)),t={style:e(),tempo:e(),key:e(),mode:e()},a=n.style??y(A,t.style),o=k[a],s=o.tempo[1]-o.tempo[0],c=p(Math.round(n.tempo??o.tempo[0]+s*t.tempo),40,200),d=((n.key??Math.floor(t.key*12))%12+12)%12,i=n.mode??y(o.modes,t.mode),l=y(o.progressions,e()).map(u=>L(i,d,u,e()<o.sevenths));return{seed:r,style:a,sound:o,tempo:c,swing:o.swing,key:d,mode:i,chords:l,kick:y(o.kick,e()),snare:y(o.snare,e()),hat:y(o.hat,e()),bass:y(o.bass,e()),motif:H(e)}}function C(n,r){let e=n.sound.layers;return e.filter((t,a)=>r*e.length>a*.95)}var B=(n,r)=>({part:n,note:0,length:1,gain:r});function I(n,{score:r,bar:e,step:t}){let a=r[n].charAt(t),o=S(x(r.seed,e,t,n.length)),s=(e+1)%r.chords.length===0&&t>=13;return n==="snare"&&s&&r.snare.includes("x")&&o<.55?[B(n,.45+o*.4)]:a==="x"?n==="hat"&&o<.08?[]:[B(n,.85+o*.15)]:a==="o"?[B(n,.4+o*.15)]:[]}function Y({score:n,step:r,chord:e}){let t=n.bass.charAt(r),a={r:0,5:7,o:12}[t];if(a===void 0)return[];let o=1;for(;r+o<f&&n.bass.charAt(r+o)==="."&&o<8;)o+=1;return[{part:"bass",note:e.root+a,length:o,gain:.9}]}var F=[0,6,10];function z({score:n,bar:r,step:e,chord:t}){let a=(o,s)=>t.notes.map(c=>({part:"chord",note:c,length:o,gain:s}));switch(n.sound.comp){case"pad":return e===0?a(f,.6):[];case"stab":return F.includes(e)?a(2.5,e===0?.75:.55):[];case"pulse":return e%2===0?a(1.6,e%8===0?.6:.4):[];case"arp":{if(e%2===1)return[];let o=e/2+r*3;return[{part:"chord",note:m(t.notes,o)+(o%(t.notes.length*2)>=t.notes.length?12:0),length:1.8,gain:.55}]}}}function J({score:n,bar:r,step:e,chord:t}){if(e%2===1)return[];let a=Math.floor(r/2);if(a%4===3)return[];let o=e/2,s=S(x(n.seed,a%2,r%2,o,7)),c=e%8===0;if(!c&&s>n.sound.lead*1.6)return[];let d=c?m([0,2,4],Math.floor(s*3)):m(n.motif,o+r%2*3),i=h(n.mode,60+n.key,t.degree+d);return[{part:"lead",note:i>84?i-12:i,length:c?3:1.7,gain:c?.7:.55}]}function R(n,r,e=1){let t=Math.floor(r/f),a={score:n,bar:t,step:r%f,chord:m(n.chords,t)};return C(n,e).flatMap(o=>o==="bass"?Y(a):o==="chord"?z(a):o==="lead"?J(a):I(o,a))}var K={soft:{wave:"sine",attack:.02,decay:.3,sustain:.5,release:.25,level:.5},keys:{wave:"triangle",attack:.005,decay:.5,sustain:.2,release:.3,level:.5,cutoff:2600},pluck:{wave:"sawtooth",attack:.003,decay:.22,sustain:0,release:.1,level:.45,cutoff:2e3},pad:{wave:"sawtooth",attack:.5,decay:.6,sustain:.7,release:1.2,level:.2,cutoff:1100,spread:9},bell:{wave:"sine",attack:.004,decay:1.4,sustain:0,release:.4,level:.4,fm:[3.5,1.6]},saw:{wave:"sawtooth",attack:.01,decay:.2,sustain:.6,release:.15,level:.24,cutoff:3e3,spread:6},square:{wave:"square",attack:.003,decay:.08,sustain:.7,release:.04,level:.16},sub:{wave:"triangle",attack:.008,decay:.25,sustain:.7,release:.12,level:.7,cutoff:500}};function Q(n,r,e){let t=e.gain*r.level,a=Math.max(e.seconds,r.attack);return n.setValueAtTime(0,e.time),n.linearRampToValueAtTime(t,e.time+r.attack),n.setTargetAtTime(t*r.sustain,e.time+r.attack,r.decay/3),n.setTargetAtTime(0,e.time+a,r.release/3),e.time+a+r.release*1.6+.05}function U(n,r,e,t){if(!t.fm)return;let[a,o]=t.fm,s=n.createOscillator(),c=n.createGain();s.frequency.value=e.frequency*a,c.gain.setValueAtTime(e.frequency*o,e.time),c.gain.setTargetAtTime(0,e.time,t.decay/4),s.connect(c).connect(r.frequency),s.start(e.time),s.stop(e.time+t.decay*2+e.seconds)}function M(n,r,e,t){let a=K[e],o=n.createGain(),s=Q(o.gain,a,t),c=o;if(a.cutoff!==void 0){let d=n.createBiquadFilter();d.type="lowpass",d.frequency.value=Math.max(a.cutoff,t.frequency*1.5),d.connect(o),c=d}for(let d of a.spread===void 0?[0]:[-a.spread,a.spread]){let i=n.createOscillator();i.type=a.wave,i.frequency.value=t.frequency,i.detune.value=d,U(n,i,t,a),i.connect(c),i.start(t.time),i.stop(s)}o.connect(r)}function O(n,r){let{ctx:e,out:t,noise:a}=n,[o,s,c,d,i]=r,l=e.createBufferSource(),u=e.createBiquadFilter(),b=e.createGain();l.buffer=a,u.type=o,u.frequency.value=s,b.gain.setValueAtTime(d,c),b.gain.exponentialRampToValueAtTime(.001,c+i),l.connect(u).connect(b).connect(t),l.start(c,c*7.3%.5),l.stop(c+i+.02)}function P(n,r,e){let[t,a,o,s,c]=e,d=n.createOscillator(),i=n.createGain();d.frequency.setValueAtTime(t,o),d.frequency.exponentialRampToValueAtTime(a,o+c*.4),i.gain.setValueAtTime(s,o),i.gain.exponentialRampToValueAtTime(.001,o+c),d.connect(i).connect(r),d.start(o),d.stop(o+c+.02)}function E(n,r,e,t){let{ctx:a,out:o}=n;if(r==="kick"){P(a,o,[150,45,e,t,.32]);return}if(r==="hat"){O(n,["highpass",7500,e,t*.5,t>.6?.06:.035]);return}O(n,["bandpass",1900,e,t*.8,.17]),P(a,o,[210,150,e,t*.5,.09])}var G={kick:.9,snare:.6,hat:.28,bass:.7,chord:.5,lead:.55},W={kick:0,snare:.3,hat:.15,bass:0,chord:.8,lead:1},X={kick:0,snare:0,hat:0,bass:0,chord:.4,lead:1},_=Object.keys(G);function j(n,r,e){let t=Math.floor(n.sampleRate*r),a=n.createBuffer(2,t,n.sampleRate);for(let o=0;o<2;o+=1){let s=g(24301+o),c=a.getChannelData(o);for(let d=0;d<t;d+=1)c[d]=(s()*2-1)*Math.exp(-e*d/t)}return a}function Z(n,r){let e=n.createGain(),t=n.createDynamicsCompressor(),a=n.createConvolver(),o=n.createDelay(1.5),s=n.createGain();e.gain.value=r.gain??.8,a.buffer=j(n,2.4,6),s.gain.value=.36,o.connect(s).connect(o),o.connect(e),a.connect(e),e.connect(t).connect(r.destination??n.destination);let c=i=>{let l={bus:n.createGain(),space:n.createGain(),echo:n.createGain()};return l.bus.gain.value=G[i],l.bus.connect(e),l.bus.connect(l.space).connect(a),l.bus.connect(l.echo).connect(o),l},d=Object.fromEntries(_.map(i=>[i,c(i)]));return{ctx:n,master:e,noise:j(n,1,0),delay:o,channels:d}}function w(n,r){n.delay.delayTime.value=p(60/r.tempo*.75,.05,1.5);for(let e of _)n.channels[e].space.gain.value=r.sound.space*W[e]*.5,n.channels[e].echo.gain.value=r.sound.echo*X[e]*.5}function $(n,r,e,t){let a=n.channels[e.part].bus;if(e.part==="kick"||e.part==="snare"||e.part==="hat"){E({ctx:n.ctx,out:a,noise:n.noise},e.part,t,e.gain);return}let o=e.length*60/r.tempo/4,s=440*2**((e.note-69)/12);M(n.ctx,a,r.sound.voices[e.part],{time:t,frequency:s,seconds:o,gain:e.gain})}function D(n,r,e){let[t,a,o]=e,s=60/r.tempo/4,c=t%2===1?r.swing*s:0;for(let d of R(r,t,o))$(n,r,d,a+c);return s}function q(n,r,e){let t=n.ctx.currentTime;for(;r.score&&r.next<t+e;){r.pending&&r.step%f===0&&(r.score=r.pending,r.pending=void 0,w(n,r.score));let a=r.next<t-.1;r.next+=a?60/r.score.tempo/4:D(n,r.score,[r.step,r.next,r.energy]),r.step+=1}}function ee(n,r={}){let e=Z(n,r),t=r.lookahead??.15,a={score:void 0,pending:void 0,energy:1,step:0,next:0,timer:void 0},o=()=>{a.timer!==void 0&&clearInterval(a.timer),a.timer=void 0,a.score=void 0,a.pending=void 0};return{output:e.master,get step(){return a.step},get playing(){return a.timer!==void 0},start(s,c=a.energy){o(),Object.assign(a,{score:s,energy:p(c,0,1),step:0,next:n.currentTime+.06}),w(e,s),a.timer=setInterval(()=>{q(e,a,t)},25),q(e,a,t)},setScore(s){a.score&&(a.pending=s)},setEnergy(s){a.energy=p(s,0,1)},setGain(s,c=.3){e.master.gain.setTargetAtTime(p(s,0,1),n.currentTime,Math.max(.01,c/3))},schedule(s,{steps:c,from:d=0,at:i=0,energy:l=1}){w(e,s);let u=i;for(let b=d;b<d+c;b+=1)u+=D(e,s,[b,u,l]);return u},stop:o}}export{T as MODES,f as STEPS_PER_BAR,k as STYLES,A as STYLE_NAMES,ee as createBand,E as drum,R as eventsAt,h as noteOf,C as partsAt,V as scoreOf,v as seedNumber,M as strike};
@@ -0,0 +1,2 @@
1
+ export declare const BUTTERFLY_VERTEX = "\nattribute vec2 aWing;\nattribute float aFlap;\nuniform float uTime, uFlapHz, uStill;\nvarying vec2 vWing;\nvarying float vShade;\nvoid main() {\n float beat = sin(6.2831853 * uFlapHz * uTime + aFlap);\n // (Wings from 30 degrees under level to 70 over; still, open and a little raised.)\n float a = mix(0.35 + 0.87 * beat, 0.15, uStill);\n float b = a * 1.35;\n float span = position.x;\n float inner = min(span, 0.45);\n float outer = max(span - 0.45, 0.0);\n vec2 xy = inner * vec2(cos(a), sin(a)) + outer * vec2(cos(b), sin(b));\n float side = aWing.x;\n vec3 p = side == 0.0 ? position : vec3(xy.x * side, xy.y, position.z);\n // (The body rises as the wings come down.)\n p.y -= 0.06 * beat * (1.0 - uStill);\n vec3 n = side == 0.0 ? vec3(0.0, 1.0, 0.0) : vec3(-sin(a) * side, cos(a), 0.0);\n vec3 world = normalize(mat3(modelMatrix) * mat3(instanceMatrix) * n);\n vShade = 0.6 + 0.4 * abs(world.y);\n vWing = aWing;\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * instanceMatrix * vec4(p, 1.0);\n}\n";
2
+ export declare const BUTTERFLY_FRAGMENT = "\nuniform vec3 uUpper, uUnder, uBody;\nuniform float uGlow, uLight;\nvarying vec2 vWing;\nvarying float vShade;\nvoid main() {\n vec3 wing = gl_FrontFacing ? uUpper : uUnder;\n vec3 base = mix(uBody, wing, abs(vWing.x));\n float rim = smoothstep(0.55, 1.0, vWing.y);\n vec3 c = base * uLight * vShade + rim * uGlow * mix(base, vec3(1.0), 0.65);\n gl_FragColor = vec4(c, 1.0);\n}\n";
@@ -0,0 +1,68 @@
1
+ export type Vec3 = readonly [number, number, number];
2
+ /** A sphere no butterfly enters (a face, a product): one that would is pushed to its surface. */
3
+ export interface KeepOut {
4
+ readonly centre: Vec3;
5
+ readonly radius: number;
6
+ }
7
+ /** The three colours of a butterfly, as hex. */
8
+ export interface ButterflyColors {
9
+ /** The wings' upper side, their underside, and the body. */
10
+ readonly upper: string;
11
+ readonly under: string;
12
+ readonly body: string;
13
+ }
14
+ /** How a flock looks and flies. Every field has a default (`DEFAULT_BUTTERFLIES`). */
15
+ export interface ButterflySettings {
16
+ /** How many, 0 to 50. */
17
+ readonly count: number;
18
+ /** Lays the flock: the same seed, the same flights. */
19
+ readonly seed: number;
20
+ /** The point they wander about, and how far along x, y and z they may go from it, world units. */
21
+ readonly centre: Vec3;
22
+ readonly radius: Vec3;
23
+ /** Wingspan, world units. */
24
+ readonly scale: number;
25
+ /** The slowest wander's rate, radians a second; the faster sines run at about 2 and 4 times it. */
26
+ readonly speed: number;
27
+ /** Wingbeats a second. */
28
+ readonly flapHz: number;
29
+ readonly colors: ButterflyColors;
30
+ /** Multiplies the white edge light: over about 1 it reaches a bloom threshold of 1, so the edges glow. */
31
+ readonly glow: number;
32
+ /** Multiplies the wing and body colours. */
33
+ readonly light: number;
34
+ readonly keepOut: readonly KeepOut[];
35
+ }
36
+ export declare const DEFAULT_BUTTERFLIES: ButterflySettings;
37
+ /** One butterfly's flight: three rates, amplitudes and phases an axis (x0 x1 x2 y0 ... z2), and its wingbeat phase. */
38
+ export interface Flight {
39
+ readonly rate: readonly number[];
40
+ readonly reach: readonly number[];
41
+ readonly phase: readonly number[];
42
+ readonly flap: number;
43
+ }
44
+ /** Where a butterfly is and the way it faces (a unit vector). */
45
+ export interface Pose {
46
+ readonly at: Vec3;
47
+ readonly front: Vec3;
48
+ }
49
+ /** A uniform number in [0, 1) for a seed, a butterfly and a channel: a 32-bit integer hash, exact everywhere. */
50
+ export declare function flightHash(seed: number, index: number, channel: number): number;
51
+ /** Settings with every missing or out-of-range field put right. */
52
+ export declare function butterflySettings(partial?: Partial<ButterflySettings>): ButterflySettings;
53
+ /**
54
+ * Lays a flock's flights from its settings: the same seed gives the same numbers on every engine.
55
+ *
56
+ * @param partial Settings; anything missing takes `DEFAULT_BUTTERFLIES`.
57
+ * @returns One flight a butterfly.
58
+ */
59
+ export declare function planFlights(partial?: Partial<ButterflySettings>): Flight[];
60
+ /**
61
+ * Where a butterfly is at a time, and the way it faces.
62
+ *
63
+ * @param flight One of `planFlights`'s flights.
64
+ * @param time Seconds on the host's clock.
65
+ * @param settings The flock's settings (its centre and keep-outs).
66
+ * @returns The pose.
67
+ */
68
+ export declare function flyAt(flight: Flight, time: number, settings?: Partial<ButterflySettings>): Pose;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * butterflies: a small flock of glowing butterflies for keel/lit (see the README). keel/lit is passed in, so this
3
+ * module imports nothing. The time comes from the host's clock, never a wall clock.
4
+ */
5
+ import type { ButterflyColors, ButterflySettings } from "./flight.js";
6
+ import type { ShapeLike } from "./wing.js";
7
+ export { BUTTERFLY_FRAGMENT, BUTTERFLY_VERTEX } from "./butterflies.glsl.js";
8
+ export { DEFAULT_BUTTERFLIES, butterflySettings, flightHash, flyAt, planFlights } from "./flight.js";
9
+ export type { ButterflyColors, ButterflySettings, Flight, KeepOut, Pose, Vec3 } from "./flight.js";
10
+ export { wingMesh, wingOutline, windingOf } from "./wing.js";
11
+ export type { ShapeLike, WingMesh, WingPoint } from "./wing.js";
12
+ interface AttributeLike {
13
+ readonly array: ArrayLike<number>;
14
+ needsUpdate: boolean;
15
+ }
16
+ interface NodeLike {
17
+ frustumCulled: boolean;
18
+ visible: boolean;
19
+ }
20
+ interface InstancesLike extends NodeLike {
21
+ count: number;
22
+ readonly instanceMatrix: {
23
+ readonly array: Float32Array;
24
+ needsUpdate: boolean;
25
+ };
26
+ }
27
+ interface GeometryLike {
28
+ setAttribute(name: string, attribute: unknown): unknown;
29
+ setIndex(index: readonly number[]): unknown;
30
+ dispose(): void;
31
+ }
32
+ interface MaterialLike {
33
+ dispose(): void;
34
+ }
35
+ interface ColorLike {
36
+ readonly r: number;
37
+ readonly g: number;
38
+ readonly b: number;
39
+ }
40
+ interface Vector3Like {
41
+ set(x: number, y: number, z: number): unknown;
42
+ }
43
+ /** The parts of keel/lit this module calls. Pass the keel/lit namespace itself. */
44
+ export interface LitLike {
45
+ readonly Instances: new (geometry: unknown, material: unknown, count: number) => InstancesLike;
46
+ readonly Geometry: new () => GeometryLike;
47
+ readonly Attribute: new (array: Float32Array, size: number) => AttributeLike;
48
+ readonly InstanceAttribute: new (array: Float32Array, size: number) => AttributeLike;
49
+ readonly CustomMaterial: new (parameters: Readonly<Record<string, unknown>>) => MaterialLike;
50
+ readonly Color: new (value?: string) => ColorLike;
51
+ readonly Vector3: new (x?: number, y?: number, z?: number) => Vector3Like;
52
+ readonly Shape: new () => ShapeLike;
53
+ }
54
+ /** One frame: the host's clock. */
55
+ export interface ButterflyFrame {
56
+ /** Seconds on the host's clock. Ignored when `still`. */
57
+ readonly time: number;
58
+ /** Reduced motion: the flock holds where it is at time 0, wings open, still glowing. */
59
+ readonly still?: boolean;
60
+ }
61
+ /** A flock in the scene. */
62
+ export interface Butterflies {
63
+ /** The instanced mesh: add it to the stage. */
64
+ readonly mesh: NodeLike;
65
+ /** Places the flock and beats its wings for the next draw. */
66
+ update(frame: ButterflyFrame): void;
67
+ /** Recolours the flock (a section's hue). */
68
+ setColors(colors: Partial<ButterflyColors>): void;
69
+ dispose(): void;
70
+ }
71
+ /**
72
+ * Makes a flock of butterflies: one instanced mesh, two wings from a Shape and a body, the wings beating in the vertex
73
+ * shader on the host's clock; the flock wanders as sums of sines, worked out on the CPU each update.
74
+ *
75
+ * @param lit The keel/lit namespace.
76
+ * @param settings The flock's settings; anything missing takes `DEFAULT_BUTTERFLIES`.
77
+ * @returns The flock: add `mesh` to the stage.
78
+ */
79
+ export declare function createButterflies(lit: LitLike, settings?: Partial<ButterflySettings>): Butterflies;