omnipython-apps 0.1.4.dev8__py3-none-any.whl

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 (218) hide show
  1. apps/__init__.py +5 -0
  2. apps/about/__init__.py +257 -0
  3. apps/about/app.json +1 -0
  4. apps/about/credits.py +12 -0
  5. apps/about/facts.py +398 -0
  6. apps/about/fonts/OFL.txt +93 -0
  7. apps/about/fonts/latin1_14.bin +0 -0
  8. apps/about/fonts/latin1_16.bin +0 -0
  9. apps/about/fonts/latin1_24.bin +0 -0
  10. apps/about/fonts/latin1_32.bin +0 -0
  11. apps/about/fonts/latin1_40.bin +0 -0
  12. apps/backline/__init__.py +58 -0
  13. apps/backline/app.json +1 -0
  14. apps/backline/app.py +475 -0
  15. apps/backline/art.py +717 -0
  16. apps/backline/ask.py +781 -0
  17. apps/backline/box.py +502 -0
  18. apps/backline/cast.py +137 -0
  19. apps/backline/desk/__init__.py +329 -0
  20. apps/backline/desk/editor.py +331 -0
  21. apps/backline/desk/grid.py +154 -0
  22. apps/backline/desk/look.py +169 -0
  23. apps/backline/desk/pedals.py +102 -0
  24. apps/backline/desk/perform.py +157 -0
  25. apps/backline/desk/prompt.py +210 -0
  26. apps/backline/desk/strip.py +159 -0
  27. apps/backline/desk_main.py +226 -0
  28. apps/backline/engine.py +622 -0
  29. apps/backline/floor.py +509 -0
  30. apps/backline/footswitch.py +119 -0
  31. apps/backline/glyphs.py +82 -0
  32. apps/backline/kits.py +428 -0
  33. apps/backline/midipedal.py +362 -0
  34. apps/backline/page_data.py +413 -0
  35. apps/backline/parts.py +145 -0
  36. apps/backline/pedal.py +107 -0
  37. apps/backline/remote.py +134 -0
  38. apps/backline/songs/ballad_68.json +1 -0
  39. apps/backline/songs/bossa.json +1 -0
  40. apps/backline/songs/country_train.json +1 -0
  41. apps/backline/songs/funk.json +1 -0
  42. apps/backline/songs/metal.json +1 -0
  43. apps/backline/songs/pop.json +1 -0
  44. apps/backline/songs/rock.json +1 -0
  45. apps/backline/songs/shuffle.json +1 -0
  46. apps/battery/__init__.py +101 -0
  47. apps/battery/app.json +1 -0
  48. apps/bit_world/act_deck.py +683 -0
  49. apps/bit_world/act_game.py +762 -0
  50. apps/bit_world/act_pet.py +1032 -0
  51. apps/bit_world/app.json +1 -0
  52. apps/bit_world/bit_output.py +45 -0
  53. apps/bit_world/bit_palette.py +503 -0
  54. apps/bit_world/bit_sound.py +431 -0
  55. apps/bit_world/bit_sprites.py +632 -0
  56. apps/bit_world/bit_world.py +534 -0
  57. apps/btreceiver/__init__.py +690 -0
  58. apps/btreceiver/app.json +1 -0
  59. apps/btreceiver/chime.py +155 -0
  60. apps/btreceiver/demo.py +529 -0
  61. apps/btreceiver/screen.py +633 -0
  62. apps/camera/__init__.py +316 -0
  63. apps/camera/app.json +1 -0
  64. apps/card/__init__.py +113 -0
  65. apps/card/app.json +1 -0
  66. apps/cast/__init__.py +631 -0
  67. apps/cast/app.json +1 -0
  68. apps/cast/receivers.py +193 -0
  69. apps/chess/__init__.py +18 -0
  70. apps/chess/app.json +1 -0
  71. apps/chess/app.py +922 -0
  72. apps/chess/art.py +323 -0
  73. apps/chess/ble.py +411 -0
  74. apps/chess/engine.py +925 -0
  75. apps/chess/game.py +327 -0
  76. apps/chess/net.py +261 -0
  77. apps/clock/__init__.py +38 -0
  78. apps/clock/app.json +1 -0
  79. apps/detect/__init__.py +214 -0
  80. apps/detect/app.json +1 -0
  81. apps/fmsynth/__init__.py +41 -0
  82. apps/fmsynth/algorithms.py +61 -0
  83. apps/fmsynth/app.json +1 -0
  84. apps/fmsynth/app.py +355 -0
  85. apps/fmsynth/editor.py +206 -0
  86. apps/fmsynth/engine.py +257 -0
  87. apps/fmsynth/meters.py +262 -0
  88. apps/fmsynth/midi.py +375 -0
  89. apps/fmsynth/panel_view.py +1071 -0
  90. apps/fmsynth/patches/fmsynth-01.syx +0 -0
  91. apps/fmsynth/settings.py +138 -0
  92. apps/fmsynth/voice.py +398 -0
  93. apps/gamepad/__init__.py +685 -0
  94. apps/gamepad/app.json +1 -0
  95. apps/gamepad/pad.py +94 -0
  96. apps/gamepad/watch.py +352 -0
  97. apps/hidden/__init__.py +72 -0
  98. apps/hidden/app.json +1 -0
  99. apps/home/__init__.py +483 -0
  100. apps/home/app.json +1 -0
  101. apps/home/main.py +36 -0
  102. apps/homeassistant/__init__.py +213 -0
  103. apps/homeassistant/api.py +104 -0
  104. apps/homeassistant/app.json +1 -0
  105. apps/huey/__init__.py +287 -0
  106. apps/huey/acting.py +184 -0
  107. apps/huey/actor.py +194 -0
  108. apps/huey/app.json +1 -0
  109. apps/huey/client.py +125 -0
  110. apps/huey/servers.py +121 -0
  111. apps/huey/settings.example.json +8 -0
  112. apps/huey/settings.py +97 -0
  113. apps/huey/turn.py +504 -0
  114. apps/huey/voice.py +217 -0
  115. apps/info/__init__.py +810 -0
  116. apps/info/app.json +1 -0
  117. apps/lora/__init__.py +62 -0
  118. apps/lora/app.json +1 -0
  119. apps/manifest.py +71 -0
  120. apps/medialink_baby_monitor/__init__.py +222 -0
  121. apps/medialink_baby_monitor/app.json +1 -0
  122. apps/medialink_doorbell/__init__.py +251 -0
  123. apps/medialink_doorbell/app.json +1 -0
  124. apps/medialink_hands_free/__init__.py +217 -0
  125. apps/medialink_hands_free/app.json +1 -0
  126. apps/medialink_surveillance_camera/__init__.py +258 -0
  127. apps/medialink_surveillance_camera/app.json +1 -0
  128. apps/medialink_video_doorbell/__init__.py +289 -0
  129. apps/medialink_video_doorbell/app.json +1 -0
  130. apps/medialink_videophone/__init__.py +273 -0
  131. apps/medialink_videophone/app.json +1 -0
  132. apps/medialink_walkie_talkie/__init__.py +228 -0
  133. apps/medialink_walkie_talkie/app.json +1 -0
  134. apps/midicontroller/__init__.py +774 -0
  135. apps/midicontroller/app.json +1 -0
  136. apps/midicontroller/links.py +421 -0
  137. apps/midicontroller/surface.py +343 -0
  138. apps/midiengine/__init__.py +977 -0
  139. apps/midiengine/app.json +1 -0
  140. apps/midiengine/banks.py +85 -0
  141. apps/midiengine/midiin.py +165 -0
  142. apps/midiengine/player.py +392 -0
  143. apps/midiengine/umidiparser.py +1413 -0
  144. apps/mp3/__init__.py +240 -0
  145. apps/mp3/app.json +1 -0
  146. apps/perch/__init__.py +119 -0
  147. apps/perch/app.json +1 -0
  148. apps/perch/huey.py +481 -0
  149. apps/perch/huey_props.py +386 -0
  150. apps/perch/huey_shift.py +42 -0
  151. apps/perch/huey_views.py +296 -0
  152. apps/perch/scene_bench.py +680 -0
  153. apps/perch/scene_coast.py +479 -0
  154. apps/perch/scene_desk.py +492 -0
  155. apps/perch/stage.py +1274 -0
  156. apps/perch/vec.py +366 -0
  157. apps/repl/__init__.py +325 -0
  158. apps/repl/app.json +1 -0
  159. apps/roku/__init__.py +156 -0
  160. apps/roku/app.json +1 -0
  161. apps/rokucam/__init__.py +362 -0
  162. apps/rokucam/app.json +1 -0
  163. apps/security/__init__.py +261 -0
  164. apps/security/app.json +1 -0
  165. apps/settings/__init__.py +221 -0
  166. apps/settings/app.json +1 -0
  167. apps/shell/__init__.py +33 -0
  168. apps/shell/app.json +1 -0
  169. apps/spotify/__init__.py +669 -0
  170. apps/spotify/app.json +1 -0
  171. apps/spotify/screen.py +82 -0
  172. apps/steps/__init__.py +58 -0
  173. apps/steps/app.json +1 -0
  174. apps/stompbox/__init__.py +31 -0
  175. apps/stompbox/app.json +1 -0
  176. apps/stompbox/app.py +668 -0
  177. apps/stompbox/boards.json +20 -0
  178. apps/stompbox/effects.py +241 -0
  179. apps/stompbox/engine.py +340 -0
  180. apps/stompbox/footswitch.py +331 -0
  181. apps/stompbox/inputs.py +449 -0
  182. apps/stompbox/meter.py +72 -0
  183. apps/stompbox/outputs.py +135 -0
  184. apps/stompbox/pedals.txt +45 -0
  185. apps/stompbox/presets.py +106 -0
  186. apps/stompbox/styles.py +135 -0
  187. apps/stompbox/ui.py +817 -0
  188. apps/stompbox/wavfile.py +73 -0
  189. apps/synthstation/__init__.py +20 -0
  190. apps/synthstation/app.json +1 -0
  191. apps/synthstation/audio.py +397 -0
  192. apps/synthstation/catalog.py +50 -0
  193. apps/synthstation/meters.py +136 -0
  194. apps/synthstation/midi.py +380 -0
  195. apps/synthstation/pads.py +177 -0
  196. apps/synthstation/parts.py +128 -0
  197. apps/synthstation/station.py +1069 -0
  198. apps/system/__init__.py +11 -0
  199. apps/system/app.json +1 -0
  200. apps/touchcal/__init__.py +324 -0
  201. apps/touchcal/app.json +1 -0
  202. apps/touchcal/fit.py +262 -0
  203. apps/wake/__init__.py +268 -0
  204. apps/wake/app.json +1 -0
  205. apps/wake/feed.py +155 -0
  206. apps/watch/__init__.py +355 -0
  207. apps/watch/app.json +1 -0
  208. apps/watch/faces.py +35 -0
  209. apps/watch/wheel.py +157 -0
  210. apps/weather/__init__.py +278 -0
  211. apps/weather/app.json +1 -0
  212. apps/weather/icons.py +172 -0
  213. apps/weather/sizing.py +71 -0
  214. apps/weather/zippad.py +172 -0
  215. omnipython_apps-0.1.4.dev8.dist-info/METADATA +33 -0
  216. omnipython_apps-0.1.4.dev8.dist-info/RECORD +218 -0
  217. omnipython_apps-0.1.4.dev8.dist-info/WHEEL +5 -0
  218. omnipython_apps-0.1.4.dev8.dist-info/top_level.txt +1 -0
@@ -0,0 +1,296 @@
1
+ # SPDX-FileCopyrightText: 2026 Brad Barnett
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ """The chameleon from other sides: head-on, turned toward you, from behind, from above.
5
+
6
+ Each view sits above the origin like the side view in `huey`:
7
+ x to the right, y down, the top of the perch at y = 0. Each returns its
8
+ shapes for a `vec.Doc` and takes the same colours, moods and eyes.
9
+ """
10
+
11
+ from .huey import COLORS, _eye, _foot, _hand, _perch, _spiral, _spiral_points
12
+ from .vec import at, circle, ellipse, limb, path, smooth
13
+
14
+ _PINK = 0xFF8F8F
15
+
16
+
17
+ def _tail(cx, cy, r0, w0, start, turns, skin, shade, light):
18
+ """The wound tail with its inner shade line and outer glint."""
19
+ return (
20
+ _spiral(cx, cy, r0, r0 / 7, w0, w0 / 4, start, turns, skin)
21
+ + path(smooth(_spiral_points(cx, cy, r0, r0 / 7, start, turns, -w0 * 0.31, -w0 / 16, 0.04, 0.9, 36)), None, shade, w0 * 0.14)
22
+ + path(smooth(_spiral_points(cx, cy, r0, r0 / 7, start, turns, w0 / 4, w0 / 16, 0.02, 0.42, 20)), None, light, w0 * 0.09)
23
+ )
24
+
25
+
26
+ def _pose(mood, blink, look, look_other):
27
+ if look_other is None:
28
+ look_other = look
29
+ if mood == "sleepy":
30
+ blink = max(blink, 0.6)
31
+ return blink, look_other, mood == "happy"
32
+
33
+
34
+ def front(doc, look=(0.0, 0.15), look_other=None, blink=0, mood="calm", colors="leaf", hand=0, curl=1.0, perch="twig"):
35
+ """The chameleon facing you.
36
+
37
+ Args:
38
+ doc: The `vec.Doc` that holds the gradients.
39
+ look: Where the eye on the left points, each of x and y from -1 to 1.
40
+ look_other: Where the eye on the right points, or None for the same way.
41
+ blink (float): 0 with the eyes open, 1 closed.
42
+ mood (str): "calm", "happy", "curious" or "sleepy".
43
+ colors (str): A name from `huey.COLORS`.
44
+ hand (float): 0 with both hands on the perch, 1 with one raised in a wave.
45
+ curl (float): How tightly the tail is wound: 0 loose, 1 at rest, 2 tight.
46
+ perch (str): "twig", "wire", or None for no perch.
47
+ """
48
+ skin, shade, light, belly, spots, deep = COLORS[colors]
49
+ blink, look_other, happy = _pose(mood, blink, look, look_other)
50
+ out = []
51
+ # the tail, hanging out to one side behind him
52
+ tx, ty = -134, -70
53
+ out.append(limb(-30, -66, tx + 35, ty - 30, 0.14, 38, 27, skin))
54
+ out.append(_tail(tx, ty, 46, 27, -40, 1.25 + 0.3 * curl, skin, shade, light))
55
+ # hind legs, knees out to the sides
56
+ for s in (-1, 1):
57
+ out.append(limb(s * 56, -62, s * 104, -44, -s * 0.2, 30, 24, shade))
58
+ out.append(limb(s * 104, -46, s * 96, -6, -s * 0.2, 22, 16, shade))
59
+ # the crest, seen end on above the shoulders
60
+ out.append(circle(-30, -170, 11, deep) + circle(30, -170, 11, deep) + circle(0, -176, 12, deep))
61
+ # the body, with the pale belly down his front
62
+ out.append(path(smooth([(0, -176), (58, -156), (84, -98), (70, -44), (0, -28), (-70, -44), (-84, -98), (-58, -156)], True), skin))
63
+ out.append(path(smooth([(-58, -156), (-84, -98), (-70, -44), (-30, -31), (-52, -56), (-62, -98), (-46, -146)], True), shade))
64
+ out.append(path(smooth([(0, -128), (38, -112), (48, -66), (30, -36), (0, -30), (-30, -36), (-48, -66), (-38, -112)], True), belly))
65
+ for s in (-1, 1):
66
+ out.append(limb(s * 56, -138, s * 72, -84, s * 0.14, 12, 5, shade))
67
+ out.append(circle(s * 62, -72, 5.5, spots))
68
+ out.append(circle(s * 66, -54, 3.6, spots))
69
+ # the shadow the head throws on his chest
70
+ out.append(ellipse(0, -114, 48, 13, shade, opacity=0.4))
71
+ if perch:
72
+ out.append(_perch(perch))
73
+ out.append(_foot(-96, 3, shade, deep))
74
+ out.append(_foot(96, 3, shade, deep))
75
+ # the arms
76
+ out.append(limb(-50, -84, -44, -10, 0.24, 28, 17, skin))
77
+ out.append(_foot(-44, 3, skin, deep))
78
+ if hand > 0:
79
+ hx, hy = 44 + 82 * hand, -10 - 112 * hand
80
+ out.append(limb(58, -92, hx, hy, -0.24 + 0.36 * hand, 28, 16, skin))
81
+ if hand > 0.5:
82
+ out.append(_hand(hx, hy, skin, deep, 24))
83
+ else:
84
+ out.append(_foot(hx, hy + 8, skin, deep))
85
+ else:
86
+ out.append(limb(50, -84, 44, -10, -0.24, 28, 17, skin))
87
+ out.append(_foot(44, 3, skin, deep))
88
+
89
+ # the head: a tall helmet, the casque its peak, the snout toward you
90
+ out.append(path(smooth([(0, -292), (34, -262), (64, -214), (74, -166), (56, -128), (0, -112), (-56, -128), (-74, -166), (-64, -214), (-34, -262)], True), skin))
91
+ out.append(path(smooth([(0, -292), (-34, -262), (-64, -214), (-74, -166), (-58, -132), (-50, -168), (-40, -214), (-16, -262)], True), shade))
92
+ # the casque's ridges, running down to each brow
93
+ out.append(limb(4, -280, 10, -236, 0.06, 7, 2.5, light))
94
+ out.append(path("M-4 -284Q-30 -252 -44 -214", None, deep, 2.6, opacity=0.5))
95
+ out.append(path("M6 -284Q32 -252 46 -214", None, shade, 2.6))
96
+ # the snout: a soft ridge down the middle, nostrils either side
97
+ out.append(ellipse(3, -172, 8, 16, light))
98
+ out.append(circle(-11, -150, 2.6, deep) + circle(11, -150, 2.6, deep))
99
+ # the lower jaw, pale like the belly
100
+ out.append(path("M-60 -144Q0 -112 60 -144Q62 -126 44 -118Q0 -104 -44 -118Q-62 -126 -60 -144Z", belly))
101
+ if happy:
102
+ out.append(path("M-58 -146Q0 -124 58 -146Q44 -110 0 -108Q-44 -110 -58 -146Z", deep))
103
+ out.append(path("M-22 -116Q0 -126 22 -116Q0 -108 -22 -116Z", _PINK))
104
+ else:
105
+ out.append(path("M-64 -152Q-62 -143 -54 -140Q0 -116 54 -140Q62 -143 64 -152", None, deep, 4))
106
+ if mood == "curious":
107
+ out.append(circle(0, -122, 9, _PINK) + circle(2, -125, 2.8, 0xFFC0C0))
108
+ # the turret eyes, standing out past the sides of the head
109
+ out.append(_eye(doc, -70, -192, 39, look, blink, happy, skin, shade, light, deep))
110
+ out.append(_eye(doc, 70, -192, 39, look_other, blink, happy, skin, shade, light, deep))
111
+ return b"".join(out)
112
+
113
+
114
+ def three_quarter(doc, look=(0.4, 0.1), look_far=None, blink=0, mood="calm", colors="leaf", curl=1.0, perch="twig"):
115
+ """The chameleon turned halfway toward you, his body running back along the perch.
116
+
117
+ Args:
118
+ doc: The `vec.Doc` that holds the gradients.
119
+ look: Where the near eye points, each of x and y from -1 to 1.
120
+ look_far: Where the far eye points, or None for the same way.
121
+ blink (float): 0 with the eyes open, 1 closed.
122
+ mood (str): "calm", "happy", "curious" or "sleepy".
123
+ colors (str): A name from `huey.COLORS`.
124
+ curl (float): How tightly the tail is wound: 0 loose, 1 at rest, 2 tight.
125
+ perch (str): "twig", "wire", or None for no perch.
126
+ """
127
+ skin, shade, light, belly, spots, deep = COLORS[colors]
128
+ blink, look_far, happy = _pose(mood, blink, look, look_far)
129
+ out = []
130
+ # the tail, smaller for being farther away
131
+ tx, ty = -112, -84
132
+ out.append(limb(-50, -82, tx + 32, ty - 27, 0.10, 36, 26, skin))
133
+ out.append(_tail(tx, ty, 42, 25, -40, 1.25 + 0.3 * curl, skin, shade, light))
134
+ # far legs
135
+ out.append(limb(96, -56, 122, -8, -0.2, 24, 17, shade))
136
+ out.append(limb(-58, -44, -66, -8, 0.24, 24, 16, shade))
137
+ for bx, by, r in ((-70, -112, 8), (-56, -130, 9), (-38, -144, 10), (-18, -152, 10)):
138
+ out.append(circle(bx, by, r, deep))
139
+ # the body, shortened as he turns away
140
+ out.append(path(smooth([(-84, -84), (-56, -130), (-6, -152), (52, -140), (86, -96), (76, -46), (24, -24), (-36, -26), (-76, -46)], True), skin))
141
+ out.append(path(smooth([(-84, -84), (-76, -46), (-36, -26), (24, -24), (76, -46), (78, -58), (24, -38), (-34, -40), (-70, -56)], True), shade))
142
+ out.append(path(smooth([(-6, -70), (34, -84), (70, -64), (62, -42), (24, -26), (-20, -28), (-30, -48)], True), belly))
143
+ for sx, sy, lean in ((-50, -126, -8), (-20, -140, -3)):
144
+ out.append(limb(sx, sy, sx + lean, sy + 54, 0.16, 14, 5, shade))
145
+ for sx, sy, r in ((-62, -78, 4.5), (-36, -74, 6), (-8, -84, 6.5), (-48, -58, 3.5)):
146
+ out.append(circle(sx, sy, r, spots))
147
+ if perch:
148
+ out.append(_perch(perch))
149
+ out.append(_foot(124, 3, shade, deep))
150
+ out.append(_foot(-66, 4, shade, deep))
151
+ # near hind leg, folded, and the near arm
152
+ out.append(limb(-40, -40, -20, -22, 0.34, 32, 22, skin))
153
+ out.append(limb(-20, -24, -30, -6, 0.22, 20, 16, skin))
154
+ out.append(_foot(-32, 4, skin, deep))
155
+ out.append(limb(44, -50, 56, -10, -0.26, 28, 17, skin))
156
+ out.append(_foot(58, 3, skin, deep))
157
+
158
+ # the far eye first: it peeks round the snout
159
+ out.append(_eye(doc, 150, -196, 27, look_far, blink, happy, shade, deep, skin, deep))
160
+ # the head: wider than in profile, the snout coming toward you
161
+ out.append(path(smooth([(30, -112), (16, -160), (26, -216), (58, -256), (96, -236), (140, -196), (170, -152), (166, -118), (120, -96), (64, -94)], True), skin))
162
+ out.append(path(smooth([(30, -112), (16, -160), (26, -216), (58, -256), (50, -214), (42, -160), (46, -116)], True), shade))
163
+ out.append(limb(64, -246, 92, -214, -0.08, 7, 2.5, light))
164
+ out.append(path("M70 -248Q118 -216 150 -166", None, shade, 2.6))
165
+ out.append(ellipse(142, -150, 12, 7, light, rot=38))
166
+ out.append(circle(154, -138, 2.5, deep) + circle(134, -130, 2.5, deep))
167
+ out.append(path("M54 -124Q110 -98 166 -128Q170 -112 154 -102Q110 -86 64 -98Q52 -108 54 -124Z", belly))
168
+ if happy:
169
+ out.append(path("M52 -126Q110 -104 168 -130Q158 -98 112 -92Q70 -92 52 -126Z", deep))
170
+ out.append(path("M88 -100Q112 -108 136 -100Q112 -93 88 -100Z", _PINK))
171
+ else:
172
+ out.append(path("M46 -134Q46 -124 56 -120Q112 -100 166 -126Q170 -130 170 -136", None, deep, 4))
173
+ if mood == "curious":
174
+ out.append(limb(150, -112, 172, -98, 0.1, 7, 6, _PINK))
175
+ out.append(circle(175, -96, 8.5, _PINK) + circle(177, -99, 2.6, 0xFFC0C0))
176
+ out.append(_eye(doc, 78, -176, 41, look, blink, happy, skin, shade, light, deep))
177
+ return b"".join(out)
178
+
179
+
180
+ def back(doc, look=(-0.7, 0.3), blink=0, mood="calm", colors="leaf", curl=1.0, perch="twig"):
181
+ """The chameleon from behind, looking back at you over his shoulder.
182
+
183
+ Args:
184
+ doc: The `vec.Doc` that holds the gradients.
185
+ look: Where his one visible eye points, each of x and y from -1 to 1.
186
+ blink (float): 0 with the eye open, 1 closed.
187
+ mood (str): "calm", "happy", "curious" or "sleepy".
188
+ colors (str): A name from `huey.COLORS`.
189
+ curl (float): How tightly the tail is wound: 0 loose, 1 at rest, 2 tight.
190
+ perch (str): "twig", "wire", or None for no perch.
191
+ """
192
+ skin, shade, light, belly, spots, deep = COLORS[colors]
193
+ blink, _, happy = _pose(mood, blink, look, None)
194
+ out = []
195
+ # the arms, reaching forward past the body
196
+ for s in (-1, 1):
197
+ out.append(limb(s * 60, -108, s * 86, -8, -s * 0.2, 24, 15, shade))
198
+ # the head, turned to look back: its profile over the shoulder
199
+ head = []
200
+ head.append(path(smooth([(52, -112), (42, -160), (58, -214), (86, -240), (118, -222), (156, -178), (184, -144), (178, -116), (128, -92), (76, -94)], True), skin))
201
+ head.append(path(smooth([(50, -124), (42, -162), (58, -214), (86, -240), (74, -206), (64, -160), (62, -122)], True), shade))
202
+ head.append(limb(90, -232, 112, -204, -0.08, 7, 2.5, light))
203
+ head.append(path(smooth([(90, -116), (134, -111), (180, -128), (182, -118), (170, -104), (128, -91), (82, -95)], True), belly))
204
+ if happy:
205
+ head.append(path("M90 -121Q138 -104 182 -131Q176 -104 150 -99Q112 -96 90 -121Z", deep))
206
+ head.append(path("M118 -104Q140 -110 162 -104Q140 -98 118 -104Z", _PINK))
207
+ else:
208
+ head.append(path("M181 -130Q138 -106 92 -119Q84 -122 84 -131", None, deep, 4))
209
+ if mood == "curious":
210
+ head.append(limb(178, -127, 214, -124, 0.10, 7, 6, _PINK) + circle(217, -124, 8.5, _PINK))
211
+ head.append(circle(170, -148, 2.4, deep))
212
+ head.append(_eye(doc, 110, -164, 39, look, blink, happy, skin, shade, light, deep))
213
+ out.append(at(-52, -66, b"".join(head), scale=0.86))
214
+ # the body from behind: a wide pear, the spine down his middle
215
+ out.append(path(smooth([(0, -196), (50, -178), (86, -116), (78, -52), (0, -30), (-78, -52), (-86, -116), (-50, -178)], True), skin))
216
+ out.append(path(smooth([(-50, -178), (-86, -116), (-78, -52), (-34, -35), (-58, -62), (-64, -116), (-40, -166)], True), shade))
217
+ # bands running out from the spine, and the spots
218
+ for s in (-1, 1):
219
+ for sy, reach in ((-160, 40), (-128, 52), (-94, 54)):
220
+ out.append(limb(s * 10, sy, s * reach, sy + 34, s * 0.16, 13, 5, shade))
221
+ out.append(circle(s * 62, -84, 6, spots) + circle(s * 50, -62, 4, spots) + circle(s * 68, -108, 4, spots))
222
+ for by, r in ((-190, 9), (-170, 10), (-148, 10.5), (-124, 11), (-100, 11), (-76, 10.5)):
223
+ out.append(circle(0, by, r, deep))
224
+ # hind legs, knees out
225
+ for s in (-1, 1):
226
+ out.append(limb(s * 60, -62, s * 104, -46, -s * 0.2, 32, 24, skin))
227
+ out.append(limb(s * 104, -48, s * 96, -6, -s * 0.2, 22, 16, skin))
228
+ if perch:
229
+ out.append(_perch(perch))
230
+ for s in (-1, 1):
231
+ out.append(_foot(s * 96, 3, skin, deep))
232
+ out.append(_foot(s * 86, 3, shade, deep))
233
+ # the tail comes toward you and winds up in front
234
+ out.append(limb(0, -66, 32, -36, -0.2, 40, 27, skin))
235
+ out.append(_tail(-2, -4, 50, 30, -40, 1.25 + 0.3 * curl, skin, shade, light))
236
+ return b"".join(out)
237
+
238
+
239
+ def above(doc, look=(0.6, 0.0), look_other=None, blink=0, mood="calm", colors="leaf", curl=1.0, leaf=True):
240
+ """The chameleon from above, on a leaf, his head to the right.
241
+
242
+ Unlike the other views it is centred on the origin, about 440 units long.
243
+
244
+ Args:
245
+ doc: The `vec.Doc` that holds the gradients.
246
+ look: Where the upper eye points, each of x and y from -1 to 1.
247
+ look_other: Where the lower eye points, or None for the same way.
248
+ blink (float): 0 with the eyes open, 1 closed.
249
+ mood (str): "calm", "happy", "curious" or "sleepy".
250
+ colors (str): A name from `huey.COLORS`.
251
+ curl (float): How tightly the tail is wound: 0 loose, 1 at rest, 2 tight.
252
+ leaf (bool): Draw the leaf he lies on.
253
+ """
254
+ skin, shade, light, belly, spots, deep = COLORS[colors]
255
+ blink, look_other, happy = _pose(mood, blink, look, look_other)
256
+ out = []
257
+ if leaf:
258
+ # an autumn leaf, so any of its colours stands clear of it
259
+ out.append(path("M-250 60C-200 -120 60 -190 262 -70C230 110 -40 190 -250 60Z", 0xD98A2B))
260
+ out.append(path("M-250 60C-200 -120 60 -190 262 -70C60 -90 -120 -30 -250 60Z", 0xF0AE45))
261
+ out.append(path("M-244 58Q0 -70 256 -70", None, 0xB36A1E, 4))
262
+ for x0, y0, x1, y1 in ((-150, 8, -110, -84), (-60, -32, -10, -124), (40, -58, 100, -132), (-120, -6, -60, 92), (-20, -44, 50, 96), (80, -64, 160, 44)):
263
+ out.append(path("M%d %dQ%d %d %d %d" % (x0, y0, (x0 + x1) // 2 + 6, (y0 + y1) // 2, x1, y1), None, 0xB36A1E, 2.4, opacity=0.7))
264
+ # the limbs, splayed, each ending in his two bundles of toes
265
+ for x0, y0, x1, y1, bend, turn in ((70, -34, 122, -96, 0.3, 20), (70, 34, 126, 92, -0.3, 160), (-56, -36, -92, -100, -0.3, -30), (-56, 36, -86, 104, 0.3, 200)):
266
+ out.append(limb(x0 + 5, y0 + 9, x1 + 5, y1 + 9, bend, 28, 16, 0x000000, opacity=0.16))
267
+ out.append(limb(x0, y0, x1, y1, bend, 28, 16, shade))
268
+ out.append(_foot(x1, y1, skin, deep, turn))
269
+ out.append(ellipse(6, 12, 118, 52, 0x000000, opacity=0.16) + ellipse(146, 12, 74, 42, 0x000000, opacity=0.16))
270
+ # the tail: out behind, then wound up
271
+ tx, ty = -176, 18
272
+ out.append(limb(-96, 0, tx + 33, ty - 28, 0.18, 44, 28, skin))
273
+ out.append(_tail(tx, ty, 44, 27, -40, 1.25 + 0.3 * curl, skin, shade, light))
274
+ # the body, a long drop with a slight bend
275
+ out.append(path(smooth([(-108, 2), (-74, -40), (-10, -52), (60, -42), (96, -10), (92, 22), (56, 44), (-12, 50), (-76, 38)], True), skin))
276
+ out.append(path(smooth([(-108, 2), (-76, 38), (-12, 50), (56, 44), (92, 22), (62, 30), (-10, 36), (-70, 26)], True), shade))
277
+ # bands across the back, spots along the flank, the crest down the spine
278
+ for bx, lean in ((-62, -6), (-22, -2), (20, 2), (58, 6)):
279
+ out.append(limb(bx, -6, bx + lean, -42, -0.12, 13, 5, shade))
280
+ out.append(limb(bx, 2, bx + lean, 36, 0.12, 13, 5, shade))
281
+ for sx, sy, r in ((-46, -32, 5), (-2, -38, 5.5), (40, -34, 5), (-44, 28, 4), (0, 32, 4.5), (40, 28, 4)):
282
+ out.append(circle(sx, sy, r, spots))
283
+ for bx, r in ((-84, 7), (-64, 8), (-42, 9), (-20, 9.5), (2, 9.5), (24, 9), (46, 8.5), (66, 8)):
284
+ out.append(circle(bx, -2 + bx * 0.02, r, deep))
285
+ # the head: the casque points back over the neck, the snout forward
286
+ out.append(path(smooth([(46, -3), (88, -36), (140, -42), (192, -24), (222, -2), (192, 22), (140, 38), (88, 32)], True), skin))
287
+ out.append(path(smooth([(46, -3), (88, 32), (140, 38), (192, 22), (222, -2), (192, 10), (140, 22), (94, 16)], True), shade))
288
+ out.append(path("M56 -3Q130 -14 204 -2", None, light, 5))
289
+ out.append(path("M58 -5Q100 -26 136 -30", None, shade, 2.6))
290
+ out.append(path("M58 0Q100 22 136 28", None, deep, 2.6, opacity=0.5))
291
+ out.append(circle(210, -9, 2.4, deep) + circle(210, 5, 2.4, deep))
292
+ if mood == "curious":
293
+ out.append(limb(220, -2, 252, -4, 0.1, 7, 6, _PINK) + circle(255, -4, 8.5, _PINK))
294
+ out.append(_eye(doc, 140, -38, 24, look, blink, happy, skin, shade, light, deep))
295
+ out.append(_eye(doc, 140, 36, 24, look_other, blink, happy, skin, shade, light, deep))
296
+ return b"".join(out)