@clipen/clipen-cli 1.0.0 → 1.0.2
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/README.md +56 -48
- package/apps/web/dist/assets/{index-D5D2HiB1.js → index-DPHwA954.js} +1 -1
- package/apps/web/dist/index.html +1 -1
- package/bin/clipen.js +1 -1
- package/package.json +7 -6
- package/pyproject.toml +18 -2
- package/requirements/dev.txt +2 -0
- package/src/clipen/__init__.py +1 -1
- package/src/clipen/analysis/__init__.py +7 -7
- package/src/clipen/analysis/artifacts.py +4 -10
- package/src/clipen/analysis/audio.py +10 -8
- package/src/clipen/analysis/evidence_service.py +345 -167
- package/src/clipen/analysis/image_similarity.py +5 -14
- package/src/clipen/analysis/keyframes.py +5 -17
- package/src/clipen/analysis/models.py +5 -7
- package/src/clipen/analysis/qwen_worker.py +19 -54
- package/src/clipen/analysis/resources.py +2 -1
- package/src/clipen/analysis/runtime.py +1 -3
- package/src/clipen/analysis/service.py +16 -48
- package/src/clipen/analysis/setup.py +11 -25
- package/src/clipen/analysis/setup_cli.py +5 -15
- package/src/clipen/analysis/storage.py +96 -278
- package/src/clipen/analysis/transcription.py +40 -82
- package/src/clipen/analysis/visual.py +109 -48
- package/src/clipen/annotations/__init__.py +5 -2
- package/src/clipen/annotations/models.py +1 -1
- package/src/clipen/annotations/storage.py +132 -84
- package/src/clipen/annotations/suggestions.py +3 -8
- package/src/clipen/asr_release.py +4 -11
- package/src/clipen/bootstrap.py +71 -61
- package/src/clipen/{planning/models.py → candidates.py} +29 -47
- package/src/clipen/cli.py +4 -9
- package/src/clipen/controller/app.py +401 -214
- package/src/clipen/controller/server.py +28 -38
- package/src/clipen/domain/__init__.py +1 -1
- package/src/clipen/domain/media_time.py +3 -10
- package/src/clipen/domain/timeline.py +45 -47
- package/src/clipen/domain/validation.py +0 -1
- package/src/clipen/editing/__init__.py +1 -1
- package/src/clipen/editing/agent_models.py +4 -11
- package/src/clipen/editing/agent_repository.py +393 -172
- package/src/clipen/editing/agent_tools.py +180 -99
- package/src/clipen/editing/alignment.py +92 -52
- package/src/clipen/editing/alignment_setup.py +118 -70
- package/src/clipen/editing/alignment_worker.py +11 -9
- package/src/clipen/editing/change_report.py +95 -38
- package/src/clipen/editing/compiler.py +0 -1
- package/src/clipen/editing/component_looks.py +58 -34
- package/src/clipen/editing/component_review.py +34 -38
- package/src/clipen/editing/coordinator.py +213 -92
- package/src/clipen/editing/editorial_review.py +217 -95
- package/src/clipen/editing/evidence_jobs.py +457 -200
- package/src/clipen/editing/history_changes.py +129 -68
- package/src/clipen/editing/music_choices.py +8 -5
- package/src/clipen/editing/production_catalog.py +573 -136
- package/src/clipen/editing/production_limits.py +43 -17
- package/src/clipen/editing/production_media.py +376 -167
- package/src/clipen/editing/production_preview.py +322 -129
- package/src/clipen/editing/production_progress.py +164 -69
- package/src/clipen/editing/production_requirements.py +106 -39
- package/src/clipen/editing/production_tools.py +1064 -462
- package/src/clipen/editing/program_audio.py +211 -81
- package/src/clipen/editing/program_direction.py +59 -25
- package/src/clipen/editing/program_story.py +83 -45
- package/src/clipen/editing/program_subtitles.py +194 -96
- package/src/clipen/editing/programme_review.py +98 -50
- package/src/clipen/editing/prompt_history.py +64 -27
- package/src/clipen/editing/recut.py +65 -25
- package/src/clipen/editing/refinement_references.py +176 -86
- package/src/clipen/editing/resolve_export.py +449 -218
- package/src/clipen/editing/resolve_titles.py +162 -105
- package/src/clipen/editing/skill_tools.py +530 -154
- package/src/clipen/editing/source_dialogue.py +177 -67
- package/src/clipen/editing/speech_coverage.py +42 -22
- package/src/clipen/editing/speech_quality.py +6 -1
- package/src/clipen/editing/tool_receipts.py +78 -32
- package/src/clipen/editing/versions.py +122 -64
- package/src/clipen/editing/visual_preview.py +157 -61
- package/src/clipen/editing/workbench.py +104 -42
- package/src/clipen/finishing/audio.py +69 -30
- package/src/clipen/finishing/catalog.py +176 -93
- package/src/clipen/finishing/models.py +1 -1
- package/src/clipen/finishing/renderer.py +33 -14
- package/src/clipen/mcp_editing/__main__.py +3 -1
- package/src/clipen/mcp_editing/server.py +77 -34
- package/src/clipen/media/__init__.py +3 -3
- package/src/clipen/media/discovery.py +7 -20
- package/src/clipen/media/models.py +7 -18
- package/src/clipen/media/preview.py +14 -24
- package/src/clipen/media/probe.py +16 -44
- package/src/clipen/media/service.py +6 -19
- package/src/clipen/media/storage.py +33 -81
- package/src/clipen/music_vocabulary.py +33 -4
- package/src/clipen/power.py +8 -3
- package/src/clipen/projects/__init__.py +1 -1
- package/src/clipen/projects/deletion.py +19 -32
- package/src/clipen/projects/finishing_schema.py +3 -1
- package/src/clipen/projects/models.py +2 -5
- package/src/clipen/projects/picker.py +13 -37
- package/src/clipen/projects/service.py +8 -24
- package/src/clipen/projects/storage.py +226 -246
- package/src/clipen/provider_registry.py +9 -20
- package/src/clipen/providers/account.py +86 -35
- package/src/clipen/providers/claude.py +59 -25
- package/src/clipen/providers/claude_editing.py +14 -7
- package/src/clipen/providers/codex.py +73 -118
- package/src/clipen/providers/codex_editing.py +2 -2
- package/src/clipen/providers/editing_agent.py +19 -17
- package/src/clipen/providers/recovery.py +7 -8
- package/src/clipen/rendering/cover.py +18 -5
- package/src/clipen/rendering/custom_components.py +167 -79
- package/src/clipen/rendering/custom_render.py +62 -41
- package/src/clipen/rendering/production_effects.py +77 -45
- package/src/clipen/rendering/program_components.py +134 -73
- package/src/clipen/rendering/program_creator.py +432 -277
- package/src/clipen/rendering/program_identities.py +277 -182
- package/src/clipen/rendering/program_motion.py +140 -95
- package/src/clipen/rendering/program_studio.py +175 -116
- package/src/clipen/rendering/program_styles.py +231 -145
- package/src/clipen/rendering/program_subtitles.py +71 -34
- package/src/clipen/rendering/renderer.py +150 -121
- package/src/clipen/rendering/storage.py +9 -22
- package/src/clipen/rendering/titles.py +193 -86
- package/src/clipen/skills/__init__.py +1 -0
- package/src/clipen/skills/catalog.py +151 -55
- package/src/clipen/skills/library.py +13 -7
- package/src/clipen/skills/package.py +46 -23
- package/src/clipen/skills/visual_styles.py +29 -18
- package/src/clipen/workspace.py +15 -44
- package/install +0 -25
- package/src/clipen/planning/__init__.py +0 -9
- package/uninstall +0 -25
|
@@ -3,253 +3,348 @@
|
|
|
3
3
|
An identity is frozen in the text profile, just like its fonts and palette. These
|
|
4
4
|
are procedural overlays used by both the samples and the actual film renderer.
|
|
5
5
|
"""
|
|
6
|
+
|
|
6
7
|
import math
|
|
7
8
|
|
|
9
|
+
from .program_styles import draw_style_text, load_style_font, styled_text_length, type_outline
|
|
8
10
|
from .titles import TitleRenderError
|
|
9
|
-
from .program_styles import load_style_font, styled_text_length, draw_style_text, type_outline
|
|
10
11
|
|
|
11
|
-
HERO = {
|
|
12
|
-
IDENTITIES = {
|
|
13
|
-
|
|
12
|
+
HERO = {"program_title", "headline", "impact", "chapter", "burst"}
|
|
13
|
+
IDENTITIES = {
|
|
14
|
+
"journal",
|
|
15
|
+
"city",
|
|
16
|
+
"slow",
|
|
17
|
+
"night",
|
|
18
|
+
"food",
|
|
19
|
+
"mission",
|
|
20
|
+
"coffee",
|
|
21
|
+
"family",
|
|
22
|
+
"outdoor",
|
|
23
|
+
"portrait",
|
|
24
|
+
"retro",
|
|
25
|
+
"tech",
|
|
26
|
+
}
|
|
14
27
|
|
|
15
28
|
|
|
16
29
|
def identity(profile):
|
|
17
|
-
value = profile.get(
|
|
30
|
+
value = profile.get("presets", {}).get("appearance", {}).get("identity")
|
|
18
31
|
return value if value in IDENTITIES else None
|
|
19
32
|
|
|
20
33
|
|
|
21
34
|
def _lines(value, name, kind):
|
|
22
|
-
if kind !=
|
|
35
|
+
if kind != "program_title":
|
|
23
36
|
return (value,)
|
|
24
|
-
if
|
|
25
|
-
return tuple(value.split(
|
|
26
|
-
if name in {
|
|
27
|
-
middle = (len(value)+1)//2
|
|
37
|
+
if "・" in value:
|
|
38
|
+
return tuple(value.split("・", 1))
|
|
39
|
+
if name in {"journal", "city", "food", "family", "retro"} and len(value) > 5:
|
|
40
|
+
middle = (len(value) + 1) // 2
|
|
28
41
|
return value[:middle], value[middle:]
|
|
29
42
|
return (value,)
|
|
30
43
|
|
|
31
44
|
|
|
32
45
|
def layout(draw, font_path, timeline, item, profile):
|
|
33
|
-
name, kind = identity(profile), profile[
|
|
46
|
+
name, kind = identity(profile), profile["component_id"]
|
|
34
47
|
hero = kind in HERO
|
|
35
|
-
primary, _, detail = item.text.partition(
|
|
48
|
+
primary, _, detail = item.text.partition("\n")
|
|
36
49
|
lines = _lines(primary, name, kind)
|
|
37
50
|
h, w = timeline.height, timeline.width
|
|
38
|
-
x, y = round(w*profile[
|
|
39
|
-
pad = max(7, round(h
|
|
40
|
-
scale = (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
x, y = round(w * profile["x"]), round(h * profile["y"])
|
|
52
|
+
pad = max(7, round(h * 0.021))
|
|
53
|
+
scale = (
|
|
54
|
+
(0.13 if name in {"city", "food", "mission"} else 0.105 if name in {"journal", "night", "retro"} else 0.09)
|
|
55
|
+
if hero
|
|
56
|
+
else 0.041
|
|
57
|
+
)
|
|
58
|
+
if kind in {"impact", "burst", "reaction"}:
|
|
59
|
+
scale = 0.14 if hero else 0.067
|
|
60
|
+
size = max(12, round(h * scale))
|
|
61
|
+
minimum = max(12, round(size * 0.58))
|
|
62
|
+
small = load_style_font(font_path, max(10, round(h * 0.025)), profile, role="detail")
|
|
63
|
+
micro = load_style_font(font_path, max(8, round(h * 0.019)), profile, role="detail")
|
|
64
|
+
limit = min(w * (0.83 if hero else 0.58), w * 0.945 - x)
|
|
49
65
|
# A real header and footer are reserved in the collision footprint, rather
|
|
50
66
|
# than adding decorative marks outside the validated bounds.
|
|
51
|
-
extra = pad*(6 if name in {
|
|
67
|
+
extra = pad * (6 if name in {"coffee", "retro", "tech"} else 4)
|
|
52
68
|
while True:
|
|
53
69
|
font = load_style_font(font_path, size, profile)
|
|
54
|
-
width = max(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
70
|
+
width = max(
|
|
71
|
+
max(styled_text_length(line, font) for line in lines) + extra,
|
|
72
|
+
styled_text_length(detail, small) + pad * 4 if detail else 0,
|
|
73
|
+
styled_text_length(profile.get("eyebrow") or "FIELD EXPEDITION", micro) + pad * 7,
|
|
74
|
+
pad * 12 if hero else pad * 8,
|
|
75
|
+
)
|
|
76
|
+
height = pad * 4 + size * len(lines) * 1.18 + (small.size * 1.5 if detail else 0)
|
|
77
|
+
if (width <= limit and y + height <= h * 0.77) or size <= minimum:
|
|
60
78
|
break
|
|
61
79
|
size -= 1
|
|
62
|
-
if width > limit or y+height > h
|
|
63
|
-
raise TitleRenderError(
|
|
64
|
-
return (x, y, x+math.ceil(width), y+math.ceil(height)), font, pad
|
|
80
|
+
if width > limit or y + height > h * 0.77:
|
|
81
|
+
raise TitleRenderError("program_component_overflow")
|
|
82
|
+
return (x, y, x + math.ceil(width), y + math.ceil(height)), font, pad
|
|
65
83
|
|
|
66
84
|
|
|
67
85
|
def draw_graphic(draw, font_path, timeline, item, profile, bounds, font, pad, relative_frame=None):
|
|
68
|
-
name, kind = identity(profile), profile[
|
|
86
|
+
name, kind = identity(profile), profile["component_id"]
|
|
69
87
|
hero = kind in HERO
|
|
70
|
-
appearance = profile[
|
|
71
|
-
motion = profile[
|
|
72
|
-
entry = appearance.get(
|
|
73
|
-
exit_frames = appearance.get(
|
|
88
|
+
appearance = profile["presets"]["appearance"]
|
|
89
|
+
motion = profile["presets"]["motion"]
|
|
90
|
+
entry = appearance.get("hero_entry_frames", 20) if hero else motion["entry_frames"]
|
|
91
|
+
exit_frames = appearance.get("hero_exit_frames", 8) if hero else motion["exit_frames"]
|
|
74
92
|
relative = entry if relative_frame is None else relative_frame
|
|
75
|
-
p = min(1
|
|
76
|
-
ease = 1-(1-p)**3
|
|
77
|
-
alpha = min(1
|
|
93
|
+
p = min(1.0, max(0.0, (relative + 1) / max(1, entry)))
|
|
94
|
+
ease = 1 - (1 - p) ** 3
|
|
95
|
+
alpha = min(1.0, p * 4, max(0.0, (item.duration_frames - relative) / max(1, exit_frames)))
|
|
78
96
|
x, y, right, bottom = bounds
|
|
79
|
-
width, height = right-x, bottom-y
|
|
80
|
-
primary, _, detail = item.text.partition(
|
|
97
|
+
width, height = right - x, bottom - y
|
|
98
|
+
primary, _, detail = item.text.partition("\n")
|
|
81
99
|
lines = _lines(primary, name, kind)
|
|
82
|
-
palette = profile[
|
|
83
|
-
stroke = max(1, round(timeline.height
|
|
84
|
-
small = load_style_font(font_path, max(10, round(timeline.height
|
|
85
|
-
micro = load_style_font(font_path, max(8, round(timeline.height
|
|
100
|
+
palette = profile["presets"]["palette"]
|
|
101
|
+
stroke = max(1, round(timeline.height * 0.003))
|
|
102
|
+
small = load_style_font(font_path, max(10, round(timeline.height * 0.025)), profile, role="detail")
|
|
103
|
+
micro = load_style_font(font_path, max(8, round(timeline.height * 0.019)), profile, role="detail")
|
|
86
104
|
|
|
87
105
|
def color(key, opacity=1):
|
|
88
106
|
r, g, b, a = palette[key]
|
|
89
|
-
return r, g, b, round(a*alpha*opacity)
|
|
90
|
-
|
|
91
|
-
def text(at, value, selected=font, fill=
|
|
92
|
-
draw_style_text(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
return r, g, b, round(a * alpha * opacity)
|
|
108
|
+
|
|
109
|
+
def text(at, value, selected=font, fill="ink", outline=False):
|
|
110
|
+
draw_style_text(
|
|
111
|
+
draw,
|
|
112
|
+
at,
|
|
113
|
+
value,
|
|
114
|
+
selected,
|
|
115
|
+
color(fill),
|
|
116
|
+
type_outline(profile, selected, stroke * 2) if outline else 0,
|
|
117
|
+
color("ink"),
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
def rule(points, fill="accent", weight=1):
|
|
121
|
+
draw.line(points, fill=color(fill), width=max(1, stroke * weight))
|
|
122
|
+
|
|
123
|
+
def label(value, tx=None, ty=None, fill="accent"):
|
|
124
|
+
text((x + pad if tx is None else tx, y + pad * 0.65 if ty is None else ty), value, micro, fill)
|
|
125
|
+
|
|
126
|
+
text_x, text_y, text_fill, outlined = x + pad * 2, y + pad * 2, "paper", False
|
|
127
|
+
kicker = (
|
|
128
|
+
profile.get("eyebrow")
|
|
129
|
+
or {
|
|
130
|
+
"program_title": "ON THE SHOW",
|
|
131
|
+
"chapter": "NEXT CHAPTER",
|
|
132
|
+
"headline": "THE QUESTION",
|
|
133
|
+
"impact": "HIGHLIGHT",
|
|
134
|
+
"burst": "REACTION",
|
|
135
|
+
"reaction": "REACTION",
|
|
136
|
+
"location": "ON LOCATION",
|
|
137
|
+
"person": "IN FRAME",
|
|
138
|
+
"fact": "FIELD NOTES",
|
|
139
|
+
"pointer": "LOOK CLOSER",
|
|
140
|
+
"circle": "DETAIL",
|
|
141
|
+
}[kind]
|
|
142
|
+
)
|
|
143
|
+
if kind == "program_title" and not profile.get("eyebrow"):
|
|
144
|
+
kicker = {
|
|
145
|
+
"journal": "FIELD JOURNAL",
|
|
146
|
+
"city": "CITY / EXPLAINED",
|
|
147
|
+
"slow": "A VISUAL JOURNAL",
|
|
148
|
+
"night": "NIGHT WALK",
|
|
149
|
+
"food": "ON THE MENU",
|
|
150
|
+
"mission": "MISSION",
|
|
151
|
+
"coffee": "COFFEE NOTES",
|
|
152
|
+
"family": "LITTLE MOMENTS",
|
|
153
|
+
"outdoor": "FIELD EXPEDITION",
|
|
154
|
+
"portrait": "PORTRAIT",
|
|
155
|
+
"retro": "TRAVEL CINEMA",
|
|
156
|
+
"tech": "FIELD TEST",
|
|
157
|
+
}[name]
|
|
158
|
+
|
|
159
|
+
if name == "journal":
|
|
116
160
|
# An open notebook margin, graphite handwriting and an uneven marker.
|
|
117
|
-
text_fill =
|
|
118
|
-
rule((x+pad
|
|
161
|
+
text_fill = "ink"
|
|
162
|
+
rule((x + pad * 0.4, y + pad, x + pad * 0.4, bottom - pad), "accent")
|
|
119
163
|
for n in range(3):
|
|
120
|
-
cy = y+pad*(1+n
|
|
121
|
-
draw.ellipse((x+pad
|
|
122
|
-
label(kicker, fill=
|
|
164
|
+
cy = y + pad * (1 + n * 0.7)
|
|
165
|
+
draw.ellipse((x + pad * 0.1, cy, x + pad * 0.7, cy + pad * 0.6), outline=color("paper"), width=stroke)
|
|
166
|
+
label(kicker, fill="ink")
|
|
123
167
|
for n, value in enumerate(lines):
|
|
124
|
-
yy = y+pad*2+n*font.size*1.18
|
|
125
|
-
draw.rectangle(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
168
|
+
yy = y + pad * 2 + n * font.size * 1.18
|
|
169
|
+
draw.rectangle(
|
|
170
|
+
(
|
|
171
|
+
x + pad * 1.6,
|
|
172
|
+
yy - pad * 0.2,
|
|
173
|
+
x + pad * 2.4 + styled_text_length(value, font),
|
|
174
|
+
yy + font.size + pad * 0.2,
|
|
175
|
+
),
|
|
176
|
+
fill=color("paper", 0.96),
|
|
177
|
+
)
|
|
178
|
+
length = min(width - pad * 3, styled_text_length(lines[-1], font))
|
|
179
|
+
yy = y + pad * 2 + font.size * len(lines) * 1.18
|
|
180
|
+
rule(
|
|
181
|
+
[
|
|
182
|
+
(x + pad * 2, yy),
|
|
183
|
+
(x + pad * 2 + length * ease * 0.6, yy - pad * 0.25),
|
|
184
|
+
(x + pad * 2 + length * ease, yy + pad * 0.1),
|
|
185
|
+
],
|
|
186
|
+
"accent",
|
|
187
|
+
3,
|
|
188
|
+
)
|
|
189
|
+
elif name == "city":
|
|
132
190
|
# Printed editorial column, boxed kicker and staggered typographic rows.
|
|
133
|
-
draw.rectangle((x, y, right, bottom), fill=color(
|
|
134
|
-
draw.rectangle((x, y, x+pad
|
|
135
|
-
draw.rectangle((x+pad*2, y+pad
|
|
136
|
-
label(kicker, x+pad*2.4, y+pad
|
|
137
|
-
rule((right-pad*1.3, y+pad*2, right-pad*1.3, bottom-pad),
|
|
138
|
-
text_fill =
|
|
139
|
-
elif name ==
|
|
191
|
+
draw.rectangle((x, y, right, bottom), fill=color("paper"))
|
|
192
|
+
draw.rectangle((x, y, x + pad * 0.7, bottom), fill=color("accent"))
|
|
193
|
+
draw.rectangle((x + pad * 2, y + pad * 0.6, right - pad * 2, y + pad * 1.6), fill=color("ink"))
|
|
194
|
+
label(kicker, x + pad * 2.4, y + pad * 0.68, "paper")
|
|
195
|
+
rule((right - pad * 1.3, y + pad * 2, right - pad * 1.3, bottom - pad), "ink")
|
|
196
|
+
text_fill = "ink"
|
|
197
|
+
elif name == "slow":
|
|
140
198
|
# Small serif lockup and a single expanding hairline: no box.
|
|
141
|
-
draw.rectangle((x, y, right, bottom), fill=color(
|
|
142
|
-
text_x = x+pad
|
|
143
|
-
label(kicker, fill=
|
|
144
|
-
rule((x+pad, bottom-pad
|
|
145
|
-
elif name ==
|
|
199
|
+
draw.rectangle((x, y, right, bottom), fill=color("ink", 0.35))
|
|
200
|
+
text_x = x + pad
|
|
201
|
+
label(kicker, fill="paper")
|
|
202
|
+
rule((x + pad, bottom - pad * 0.55, x + pad + (width - pad * 2) * ease, bottom - pad * 0.55), "paper")
|
|
203
|
+
elif name == "night":
|
|
146
204
|
# Offset neon frame, cyan glyph edge and vertical index ticks.
|
|
147
|
-
draw.rectangle((x, y, right, bottom), fill=color(
|
|
148
|
-
rule(
|
|
149
|
-
|
|
205
|
+
draw.rectangle((x, y, right, bottom), fill=color("ink", 0.78))
|
|
206
|
+
rule(
|
|
207
|
+
(x + stroke, bottom - pad, x + stroke, y + stroke, x + stroke + (width - stroke * 2) * ease, y + stroke),
|
|
208
|
+
"accent",
|
|
209
|
+
2,
|
|
210
|
+
)
|
|
211
|
+
rule((x + pad, bottom, right, bottom, right, bottom - height * ease), "secondary")
|
|
150
212
|
for n in range(4):
|
|
151
|
-
rule((right-pad
|
|
213
|
+
rule((right - pad * 0.7, y + pad * (1 + n * 0.7), right - pad * 0.3, y + pad * (1 + n * 0.7)), "secondary")
|
|
152
214
|
label(kicker)
|
|
153
|
-
elif name ==
|
|
215
|
+
elif name == "food":
|
|
154
216
|
# A scalloped menu seal, red/yellow plates and bold reaction lettering.
|
|
155
217
|
pts = []
|
|
156
218
|
for n in range(40):
|
|
157
|
-
angle = math.tau*n/40
|
|
158
|
-
radius = 1 if n % 2 == 0 else .94
|
|
159
|
-
pts.append(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
219
|
+
angle = math.tau * n / 40
|
|
220
|
+
radius = 1 if n % 2 == 0 else 0.94
|
|
221
|
+
pts.append(
|
|
222
|
+
(
|
|
223
|
+
x + width / 2 + math.cos(angle) * (width / 2 - stroke) * radius,
|
|
224
|
+
y + height / 2 + math.sin(angle) * (height / 2 - stroke) * radius,
|
|
225
|
+
)
|
|
226
|
+
)
|
|
227
|
+
draw.polygon(pts, fill=color("accent"), outline=color("paper"), width=stroke * 2)
|
|
228
|
+
draw.rounded_rectangle(
|
|
229
|
+
(x + pad * 1.3, y + pad * 0.4, right - pad * 1.3, y + pad * 1.5), radius=pad * 0.5, fill=color("ink")
|
|
230
|
+
)
|
|
231
|
+
label(kicker, x + pad * 2, y + pad * 0.55, "secondary")
|
|
232
|
+
text_fill, outlined = "paper", True
|
|
233
|
+
elif name == "mission":
|
|
166
234
|
# A clipped, industrial mission placard with diagonal hazard marks.
|
|
167
|
-
cut = pad*1.2
|
|
168
|
-
draw.polygon(
|
|
169
|
-
|
|
235
|
+
cut = pad * 1.2
|
|
236
|
+
draw.polygon(
|
|
237
|
+
[(x, y), (right - cut, y), (right, y + cut), (right, bottom), (x + cut, bottom), (x, bottom - cut)],
|
|
238
|
+
fill=color("ink"),
|
|
239
|
+
)
|
|
170
240
|
for n in range(5):
|
|
171
|
-
xx = x+pad*(1+n
|
|
172
|
-
rule((xx, y+pad
|
|
173
|
-
rule((x+pad, bottom-pad
|
|
241
|
+
xx = x + pad * (1 + n * 0.7)
|
|
242
|
+
rule((xx, y + pad * 0.35, xx + pad * 0.4, y + pad * 0.9), "accent", 2)
|
|
243
|
+
rule((x + pad, bottom - pad * 0.6, x + pad + (width - pad * 2) * ease, bottom - pad * 0.6), "accent", 3)
|
|
174
244
|
# No fabricated timers, scores or progress counters in the overlay.
|
|
175
|
-
label(kicker, x+pad*5, y+pad
|
|
176
|
-
text_fill =
|
|
177
|
-
elif name ==
|
|
245
|
+
label(kicker, x + pad * 5, y + pad * 0.4, "secondary")
|
|
246
|
+
text_fill = "accent"
|
|
247
|
+
elif name == "coffee":
|
|
178
248
|
# A letterpress cafe docket: serif text, receipt edge, fine menu rules.
|
|
179
|
-
draw.rectangle((x, y, right, bottom), fill=color(
|
|
180
|
-
for n in range(max(1, round(width/pad))):
|
|
181
|
-
xx = x+n*pad
|
|
182
|
-
draw.polygon(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
249
|
+
draw.rectangle((x, y, right, bottom), fill=color("paper"))
|
|
250
|
+
for n in range(max(1, round(width / pad))):
|
|
251
|
+
xx = x + n * pad
|
|
252
|
+
draw.polygon(
|
|
253
|
+
[(xx, bottom), (min(right, xx + pad * 0.5), bottom - pad * 0.4), (min(right, xx + pad), bottom)],
|
|
254
|
+
fill=color("ink"),
|
|
255
|
+
)
|
|
256
|
+
rule((x + pad, y + pad * 1.5, right - pad, y + pad * 1.5), "ink")
|
|
257
|
+
label(kicker, fill="ink")
|
|
258
|
+
text_x, text_fill = x + pad * 2, "ink"
|
|
259
|
+
draw.arc(
|
|
260
|
+
(right - pad * 2, y + pad * 0.35, right - pad, y + pad * 1.25), 0, 320, fill=color("accent"), width=stroke
|
|
261
|
+
)
|
|
262
|
+
elif name == "family":
|
|
189
263
|
# A rounded speech bubble and a hand-drawn sun, distinct from a ticket.
|
|
190
|
-
draw.rounded_rectangle((x, y, right, bottom-pad
|
|
191
|
-
draw.polygon(
|
|
192
|
-
|
|
264
|
+
draw.rounded_rectangle((x, y, right, bottom - pad * 0.5), radius=pad * 2, fill=color("paper"))
|
|
265
|
+
draw.polygon(
|
|
266
|
+
[(x + pad * 2, bottom - pad), (x + pad * 1.5, bottom), (x + pad * 4, bottom - pad)], fill=color("paper")
|
|
267
|
+
)
|
|
193
268
|
label(kicker)
|
|
194
|
-
text_fill =
|
|
195
|
-
cx, cy = right-pad*1.5, y+pad
|
|
196
|
-
draw.ellipse((cx-pad
|
|
197
|
-
elif name ==
|
|
269
|
+
text_fill = "ink"
|
|
270
|
+
cx, cy = right - pad * 1.5, y + pad
|
|
271
|
+
draw.ellipse((cx - pad * 0.4, cy - pad * 0.4, cx + pad * 0.4, cy + pad * 0.4), fill=color("accent"))
|
|
272
|
+
elif name == "outdoor":
|
|
198
273
|
# Survey plate with topographic contour lines and an expedition rail.
|
|
199
|
-
draw.rectangle((x, y, right, bottom), fill=color(
|
|
274
|
+
draw.rectangle((x, y, right, bottom), fill=color("ink", 0.90))
|
|
200
275
|
for n in range(4):
|
|
201
|
-
yy = y+pad*(.35+n
|
|
202
|
-
rule(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
276
|
+
yy = y + pad * (0.35 + n * 0.3)
|
|
277
|
+
rule(
|
|
278
|
+
[
|
|
279
|
+
(x + pad, yy),
|
|
280
|
+
(x + width * 0.35, yy + pad * 0.2),
|
|
281
|
+
(x + width * 0.7, yy - pad * 0.1),
|
|
282
|
+
(right - pad, yy + pad * 0.3),
|
|
283
|
+
],
|
|
284
|
+
"secondary",
|
|
285
|
+
)
|
|
286
|
+
rule((x + pad * 0.5, y + pad * 2, x + pad * 0.5, bottom - pad), "accent", 2)
|
|
287
|
+
label(kicker, x + pad * 2, y + pad * 0.65, "accent")
|
|
206
288
|
outlined = True
|
|
207
|
-
elif name ==
|
|
289
|
+
elif name == "portrait":
|
|
208
290
|
# Documentary pull quote, asymmetrical red rule and quiet attribution.
|
|
209
|
-
draw.rectangle((x, y, right, bottom), fill=color(
|
|
210
|
-
rule((x+stroke*2, y, x+stroke*2, bottom),
|
|
211
|
-
text((x+pad, y+pad
|
|
212
|
-
label(kicker, x+pad*4, y+pad
|
|
213
|
-
text_x = x+pad*2
|
|
214
|
-
elif name ==
|
|
291
|
+
draw.rectangle((x, y, right, bottom), fill=color("ink", 0.65))
|
|
292
|
+
rule((x + stroke * 2, y, x + stroke * 2, bottom), "accent", 3)
|
|
293
|
+
text((x + pad, y + pad * 0.1), "“", font, "accent")
|
|
294
|
+
label(kicker, x + pad * 4, y + pad * 0.65, "paper")
|
|
295
|
+
text_x = x + pad * 2
|
|
296
|
+
elif name == "retro":
|
|
215
297
|
# Railway ticket with punch holes, double border and a perforated stub.
|
|
216
|
-
draw.rectangle((x, y, right, bottom), fill=color(
|
|
217
|
-
draw.rectangle(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
298
|
+
draw.rectangle((x, y, right, bottom), fill=color("paper"))
|
|
299
|
+
draw.rectangle(
|
|
300
|
+
(x + stroke * 3, y + stroke * 3, right - stroke * 3, bottom - stroke * 3),
|
|
301
|
+
outline=color("ink"),
|
|
302
|
+
width=stroke,
|
|
303
|
+
)
|
|
304
|
+
for yy in range(round(y + pad * 0.5), round(bottom - pad * 0.5), max(3, stroke * 4)):
|
|
305
|
+
rule((right - pad * 2, yy, right - pad * 2, yy + stroke), "accent")
|
|
306
|
+
for cy in (y + pad, bottom - pad):
|
|
307
|
+
draw.ellipse((x + pad * 0.6, cy - pad * 0.2, x + pad, cy + pad * 0.2), fill=color("ink"))
|
|
308
|
+
label(kicker, x + pad * 2, y + pad * 0.65, "accent")
|
|
309
|
+
text_fill = "ink"
|
|
224
310
|
else: # tech: no diagonal comic banner, only a measured spec interface.
|
|
225
|
-
draw.rounded_rectangle(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
311
|
+
draw.rounded_rectangle(
|
|
312
|
+
(x, y, right, bottom), radius=pad * 0.6, fill=color("ink", 0.96), outline=color("secondary"), width=stroke
|
|
313
|
+
)
|
|
314
|
+
draw.rectangle((x + pad, y + pad * 0.6, x + pad * 1.5, y + pad * 1.1), fill=color("accent"))
|
|
315
|
+
label(kicker, x + pad * 2, y + pad * 0.55, "accent")
|
|
316
|
+
rule((x + pad, y + pad * 1.6, right - pad, y + pad * 1.6), "secondary")
|
|
317
|
+
for xx in (x + pad, right - pad):
|
|
318
|
+
rule((xx, bottom - pad * 1.5, xx, bottom - pad * 0.5), "accent")
|
|
319
|
+
text_x, text_fill = x + pad * 2, "paper"
|
|
232
320
|
|
|
233
321
|
for n, value in enumerate(lines):
|
|
234
|
-
local = min(1
|
|
322
|
+
local = min(1.0, max(0.0, p * 1.5 - n * 0.28))
|
|
235
323
|
if not local:
|
|
236
324
|
continue
|
|
237
325
|
# Each package has a different entrance grammar while the final text
|
|
238
326
|
# and all transient strokes remain inside the measured footprint.
|
|
239
|
-
offset = (1-local)**3*pad
|
|
240
|
-
tx = text_x+offset if name in {
|
|
241
|
-
ty = text_y+n*font.size*1.18+(offset if name in {
|
|
242
|
-
if name ==
|
|
243
|
-
tx += pad
|
|
244
|
-
if name ==
|
|
245
|
-
text((tx+stroke, ty+stroke), value, font,
|
|
246
|
-
if name in {
|
|
247
|
-
tx += (1-ease)*pad
|
|
327
|
+
offset = (1 - local) ** 3 * pad
|
|
328
|
+
tx = text_x + offset if name in {"city", "mission", "tech"} else text_x
|
|
329
|
+
ty = text_y + n * font.size * 1.18 + (offset if name in {"journal", "slow", "portrait", "family"} else 0)
|
|
330
|
+
if name == "city" and n:
|
|
331
|
+
tx += pad * 0.5
|
|
332
|
+
if name == "night":
|
|
333
|
+
text((tx + stroke, ty + stroke), value, font, "secondary")
|
|
334
|
+
if name in {"food", "mission"} and kind in {"impact", "burst", "reaction"}:
|
|
335
|
+
tx += (1 - ease) * pad
|
|
248
336
|
text((tx, ty), value, font, text_fill, outlined)
|
|
249
337
|
if detail:
|
|
250
|
-
fill =
|
|
251
|
-
if name ==
|
|
252
|
-
draw.rectangle(
|
|
253
|
-
|
|
254
|
-
|
|
338
|
+
fill = "ink" if name in {"journal", "city", "coffee", "family", "retro"} else "paper"
|
|
339
|
+
if name == "journal":
|
|
340
|
+
draw.rectangle(
|
|
341
|
+
(
|
|
342
|
+
x + pad * 1.6,
|
|
343
|
+
bottom - pad - small.size - pad * 0.2,
|
|
344
|
+
x + pad * 2.4 + styled_text_length(detail, small),
|
|
345
|
+
bottom - pad * 0.6,
|
|
346
|
+
),
|
|
347
|
+
fill=color("paper"),
|
|
348
|
+
)
|
|
349
|
+
text((x + pad * 2, bottom - pad - small.size), detail, small, fill, name == "slow")
|
|
255
350
|
return bounds
|