@clipen/clipen-cli 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +89 -2
- package/apps/web/dist/assets/index-D5D2HiB1.js +14 -0
- package/apps/web/dist/assets/index-DIMuOXSu.css +1 -0
- package/apps/web/dist/favicon.svg +1 -0
- package/apps/web/dist/index.html +16 -0
- package/bin/clipen.js +157 -0
- package/clipen +18 -0
- package/install +25 -0
- package/package.json +55 -4
- package/pyproject.toml +44 -0
- package/requirements/asr-runtime.txt +13 -0
- package/requirements/dev.txt +2 -0
- package/requirements/runtime.txt +20 -0
- package/src/clipen/__init__.py +3 -0
- package/src/clipen/analysis/__init__.py +89 -0
- package/src/clipen/analysis/artifacts.py +410 -0
- package/src/clipen/analysis/audio.py +394 -0
- package/src/clipen/analysis/evidence.py +102 -0
- package/src/clipen/analysis/evidence_service.py +929 -0
- package/src/clipen/analysis/image_similarity.py +134 -0
- package/src/clipen/analysis/keyframes.py +159 -0
- package/src/clipen/analysis/models.py +228 -0
- package/src/clipen/analysis/qwen_worker.py +594 -0
- package/src/clipen/analysis/resources.py +22 -0
- package/src/clipen/analysis/runtime.py +62 -0
- package/src/clipen/analysis/service.py +594 -0
- package/src/clipen/analysis/setup.py +921 -0
- package/src/clipen/analysis/setup_cli.py +107 -0
- package/src/clipen/analysis/storage.py +1864 -0
- package/src/clipen/analysis/transcription.py +906 -0
- package/src/clipen/analysis/visual.py +237 -0
- package/src/clipen/annotations/__init__.py +13 -0
- package/src/clipen/annotations/models.py +22 -0
- package/src/clipen/annotations/storage.py +428 -0
- package/src/clipen/annotations/suggestions.py +115 -0
- package/src/clipen/asr_release.py +132 -0
- package/src/clipen/bootstrap.py +978 -0
- package/src/clipen/candidates.py +222 -0
- package/src/clipen/cli.py +84 -0
- package/src/clipen/controller/__init__.py +17 -0
- package/src/clipen/controller/app.py +1657 -0
- package/src/clipen/controller/server.py +533 -0
- package/src/clipen/domain/__init__.py +30 -0
- package/src/clipen/domain/errors.py +5 -0
- package/src/clipen/domain/media_time.py +110 -0
- package/src/clipen/domain/timeline.py +582 -0
- package/src/clipen/domain/validation.py +14 -0
- package/src/clipen/editing/EDITORIAL_REGRESSIONS.md +38 -0
- package/src/clipen/editing/PROGRAM_FORMAT.md +102 -0
- package/src/clipen/editing/README.md +115 -0
- package/src/clipen/editing/REFACTOR_DESIGN.md +241 -0
- package/src/clipen/editing/REFACTOR_HANDOFF.md +73 -0
- package/src/clipen/editing/__init__.py +15 -0
- package/src/clipen/editing/agent.py +13 -0
- package/src/clipen/editing/agent_models.py +127 -0
- package/src/clipen/editing/agent_repository.py +978 -0
- package/src/clipen/editing/agent_tools.py +613 -0
- package/src/clipen/editing/alignment.py +150 -0
- package/src/clipen/editing/alignment_setup.py +156 -0
- package/src/clipen/editing/alignment_worker.py +24 -0
- package/src/clipen/editing/change_report.py +128 -0
- package/src/clipen/editing/compiler.py +40 -0
- package/src/clipen/editing/component_looks.py +131 -0
- package/src/clipen/editing/component_review.py +74 -0
- package/src/clipen/editing/coordinator.py +497 -0
- package/src/clipen/editing/editorial_review.py +309 -0
- package/src/clipen/editing/evidence_jobs.py +552 -0
- package/src/clipen/editing/history_changes.py +192 -0
- package/src/clipen/editing/music_choices.py +18 -0
- package/src/clipen/editing/production_catalog.py +629 -0
- package/src/clipen/editing/production_limits.py +85 -0
- package/src/clipen/editing/production_media.py +435 -0
- package/src/clipen/editing/production_preview.py +373 -0
- package/src/clipen/editing/production_progress.py +236 -0
- package/src/clipen/editing/production_requirements.py +117 -0
- package/src/clipen/editing/production_tools.py +1198 -0
- package/src/clipen/editing/program_audio.py +248 -0
- package/src/clipen/editing/program_direction.py +83 -0
- package/src/clipen/editing/program_story.py +91 -0
- package/src/clipen/editing/program_subtitles.py +232 -0
- package/src/clipen/editing/programme_review.py +121 -0
- package/src/clipen/editing/prompt_history.py +84 -0
- package/src/clipen/editing/recut.py +167 -0
- package/src/clipen/editing/refinement_references.py +278 -0
- package/src/clipen/editing/resolve_export.py +847 -0
- package/src/clipen/editing/resolve_titles.py +291 -0
- package/src/clipen/editing/skill_tools.py +951 -0
- package/src/clipen/editing/source_dialogue.py +192 -0
- package/src/clipen/editing/speech_coverage.py +50 -0
- package/src/clipen/editing/speech_quality.py +11 -0
- package/src/clipen/editing/tool_receipts.py +98 -0
- package/src/clipen/editing/versions.py +219 -0
- package/src/clipen/editing/visual_preview.py +189 -0
- package/src/clipen/editing/workbench.py +136 -0
- package/src/clipen/filesystem.py +25 -0
- package/src/clipen/finishing/README.md +103 -0
- package/src/clipen/finishing/__init__.py +1 -0
- package/src/clipen/finishing/audio.py +188 -0
- package/src/clipen/finishing/catalog.py +264 -0
- package/src/clipen/finishing/models.py +14 -0
- package/src/clipen/finishing/renderer.py +45 -0
- package/src/clipen/mcp_editing/__init__.py +5 -0
- package/src/clipen/mcp_editing/__main__.py +42 -0
- package/src/clipen/mcp_editing/server.py +396 -0
- package/src/clipen/media/__init__.py +50 -0
- package/src/clipen/media/discovery.py +253 -0
- package/src/clipen/media/models.py +349 -0
- package/src/clipen/media/preview.py +137 -0
- package/src/clipen/media/probe.py +418 -0
- package/src/clipen/media/service.py +304 -0
- package/src/clipen/media/storage.py +694 -0
- package/src/clipen/music_vocabulary.py +34 -0
- package/src/clipen/power.py +28 -0
- package/src/clipen/projects/__init__.py +26 -0
- package/src/clipen/projects/agent_schema.py +94 -0
- package/src/clipen/projects/annotation_schema.py +40 -0
- package/src/clipen/projects/deletion.py +256 -0
- package/src/clipen/projects/evidence_schema.py +52 -0
- package/src/clipen/projects/finishing_schema.py +36 -0
- package/src/clipen/projects/models.py +189 -0
- package/src/clipen/projects/picker.py +232 -0
- package/src/clipen/projects/preview_schema.py +29 -0
- package/src/clipen/projects/service.py +159 -0
- package/src/clipen/projects/storage.py +1458 -0
- package/src/clipen/projects/timeline_schema.py +32 -0
- package/src/clipen/projects/validation_schema.py +28 -0
- package/src/clipen/provider_registry.py +77 -0
- package/src/clipen/providers/__init__.py +43 -0
- package/src/clipen/providers/account.py +245 -0
- package/src/clipen/providers/claude.py +409 -0
- package/src/clipen/providers/claude_editing.py +118 -0
- package/src/clipen/providers/codex.py +991 -0
- package/src/clipen/providers/codex_editing.py +91 -0
- package/src/clipen/providers/editing_agent.py +567 -0
- package/src/clipen/providers/errors.py +51 -0
- package/src/clipen/providers/recovery.py +269 -0
- package/src/clipen/py.typed +1 -0
- package/src/clipen/rendering/__init__.py +12 -0
- package/src/clipen/rendering/cover.py +139 -0
- package/src/clipen/rendering/custom_components.py +328 -0
- package/src/clipen/rendering/custom_render.py +218 -0
- package/src/clipen/rendering/fonts/anton-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/bebasneue-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/caveat-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/chenyu-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/delagothicone-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/hachimarupop-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/iansui-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/manifest.json +145 -0
- package/src/clipen/rendering/fonts/playfairdisplay-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/rocknrollone-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/yomogi-OFL.txt +94 -0
- package/src/clipen/rendering/fonts/yuseimagic-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/zenkurenaido-OFL.txt +93 -0
- package/src/clipen/rendering/fonts/zenmarugothic-OFL.txt +93 -0
- package/src/clipen/rendering/production_effects.py +96 -0
- package/src/clipen/rendering/program_components.py +254 -0
- package/src/clipen/rendering/program_creator.py +804 -0
- package/src/clipen/rendering/program_identities.py +350 -0
- package/src/clipen/rendering/program_motion.py +186 -0
- package/src/clipen/rendering/program_studio.py +227 -0
- package/src/clipen/rendering/program_styles.py +321 -0
- package/src/clipen/rendering/program_subtitles.py +89 -0
- package/src/clipen/rendering/renderer.py +737 -0
- package/src/clipen/rendering/storage.py +230 -0
- package/src/clipen/rendering/titles.py +467 -0
- package/src/clipen/skills/__init__.py +5 -0
- package/src/clipen/skills/builtin/SKILL.md +72 -0
- package/src/clipen/skills/builtin/assets/sample-daily-vlog.mp4 +0 -0
- package/src/clipen/skills/builtin/assets/sample-event-recap.mp4 +0 -0
- package/src/clipen/skills/builtin/assets/sample-food-review.mp4 +0 -0
- package/src/clipen/skills/builtin/assets/sample-product-demo.mp4 +0 -0
- package/src/clipen/skills/builtin/assets/sample-product-review.mp4 +0 -0
- package/src/clipen/skills/builtin/assets/sample-product-unboxing.mp4 +0 -0
- package/src/clipen/skills/builtin/assets/sample-shorts-highlight.mp4 +0 -0
- package/src/clipen/skills/builtin/assets/sample-travel-highlight.mp4 +0 -0
- package/src/clipen/skills/builtin/assets/sample-travel-vlog.mp4 +0 -0
- package/src/clipen/skills/builtin/assets/style-cinema.png +0 -0
- package/src/clipen/skills/builtin/assets/style-editorial.png +0 -0
- package/src/clipen/skills/builtin/assets/style-tpl-daily-vlog.png +0 -0
- package/src/clipen/skills/builtin/assets/style-tpl-event-recap.png +0 -0
- package/src/clipen/skills/builtin/assets/style-tpl-food-review.png +0 -0
- package/src/clipen/skills/builtin/assets/style-tpl-product-demo.png +0 -0
- package/src/clipen/skills/builtin/assets/style-tpl-product-review.png +0 -0
- package/src/clipen/skills/builtin/assets/style-tpl-product-unboxing.png +0 -0
- package/src/clipen/skills/builtin/assets/style-tpl-shorts-highlight.png +0 -0
- package/src/clipen/skills/builtin/assets/style-tpl-travel-highlight.png +0 -0
- package/src/clipen/skills/builtin/assets/style-tpl-travel-vlog.png +0 -0
- package/src/clipen/skills/builtin/assets/style-variety.png +0 -0
- package/src/clipen/skills/builtin/components.json +133 -0
- package/src/clipen/skills/builtin/font_sources.json +20 -0
- package/src/clipen/skills/builtin/font_styles.json +329 -0
- package/src/clipen/skills/builtin/manifest.json +32 -0
- package/src/clipen/skills/builtin/presets.json +8 -0
- package/src/clipen/skills/builtin/references/captions.md +14 -0
- package/src/clipen/skills/builtin/references/channel-design.md +37 -0
- package/src/clipen/skills/builtin/references/editing.md +30 -0
- package/src/clipen/skills/builtin/references/font-chenyu-OFL.txt +93 -0
- package/src/clipen/skills/builtin/references/font-iansui-OFL.txt +93 -0
- package/src/clipen/skills/builtin/references/graphics.md +59 -0
- package/src/clipen/skills/builtin/references/review.md +16 -0
- package/src/clipen/skills/builtin/references/sound.md +8 -0
- package/src/clipen/skills/builtin/references/story.md +7 -0
- package/src/clipen/skills/builtin/skills/travel-program/SKILL.md +27 -0
- package/src/clipen/skills/builtin/skills/travel-program/manifest.json +6 -0
- package/src/clipen/skills/builtin/template-skills/clipen-daily-vlog/SKILL.md +33 -0
- package/src/clipen/skills/builtin/template-skills/clipen-daily-vlog/manifest.json +8 -0
- package/src/clipen/skills/builtin/template-skills/clipen-event-recap/SKILL.md +34 -0
- package/src/clipen/skills/builtin/template-skills/clipen-event-recap/manifest.json +8 -0
- package/src/clipen/skills/builtin/template-skills/clipen-food-review/SKILL.md +33 -0
- package/src/clipen/skills/builtin/template-skills/clipen-food-review/manifest.json +8 -0
- package/src/clipen/skills/builtin/template-skills/clipen-product-demo/SKILL.md +35 -0
- package/src/clipen/skills/builtin/template-skills/clipen-product-demo/manifest.json +8 -0
- package/src/clipen/skills/builtin/template-skills/clipen-product-review/SKILL.md +36 -0
- package/src/clipen/skills/builtin/template-skills/clipen-product-review/manifest.json +8 -0
- package/src/clipen/skills/builtin/template-skills/clipen-product-unboxing/SKILL.md +39 -0
- package/src/clipen/skills/builtin/template-skills/clipen-product-unboxing/manifest.json +8 -0
- package/src/clipen/skills/builtin/template-skills/clipen-shorts-highlight/SKILL.md +38 -0
- package/src/clipen/skills/builtin/template-skills/clipen-shorts-highlight/manifest.json +8 -0
- package/src/clipen/skills/builtin/template-skills/clipen-travel-highlight/SKILL.md +34 -0
- package/src/clipen/skills/builtin/template-skills/clipen-travel-highlight/manifest.json +8 -0
- package/src/clipen/skills/builtin/template-skills/clipen-travel-vlog/SKILL.md +37 -0
- package/src/clipen/skills/builtin/template-skills/clipen-travel-vlog/manifest.json +8 -0
- package/src/clipen/skills/builtin/templates.json +284 -0
- package/src/clipen/skills/builtin/visual_styles.json +1074 -0
- package/src/clipen/skills/catalog.py +314 -0
- package/src/clipen/skills/library.py +137 -0
- package/src/clipen/skills/package.py +254 -0
- package/src/clipen/skills/visual_styles.py +55 -0
- package/src/clipen/workspace.py +181 -0
- package/uninstall +25 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"""Original channel packages: measured type, distinct geometry and native motion.
|
|
2
|
+
|
|
3
|
+
An identity is frozen in the text profile, just like its fonts and palette. These
|
|
4
|
+
are procedural overlays used by both the samples and the actual film renderer.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import math
|
|
8
|
+
|
|
9
|
+
from .program_styles import draw_style_text, load_style_font, styled_text_length, type_outline
|
|
10
|
+
from .titles import TitleRenderError
|
|
11
|
+
|
|
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
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def identity(profile):
|
|
30
|
+
value = profile.get("presets", {}).get("appearance", {}).get("identity")
|
|
31
|
+
return value if value in IDENTITIES else None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _lines(value, name, kind):
|
|
35
|
+
if kind != "program_title":
|
|
36
|
+
return (value,)
|
|
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
|
|
41
|
+
return value[:middle], value[middle:]
|
|
42
|
+
return (value,)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def layout(draw, font_path, timeline, item, profile):
|
|
46
|
+
name, kind = identity(profile), profile["component_id"]
|
|
47
|
+
hero = kind in HERO
|
|
48
|
+
primary, _, detail = item.text.partition("\n")
|
|
49
|
+
lines = _lines(primary, name, kind)
|
|
50
|
+
h, w = timeline.height, timeline.width
|
|
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)
|
|
65
|
+
# A real header and footer are reserved in the collision footprint, rather
|
|
66
|
+
# than adding decorative marks outside the validated bounds.
|
|
67
|
+
extra = pad * (6 if name in {"coffee", "retro", "tech"} else 4)
|
|
68
|
+
while True:
|
|
69
|
+
font = load_style_font(font_path, size, profile)
|
|
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:
|
|
78
|
+
break
|
|
79
|
+
size -= 1
|
|
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
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def draw_graphic(draw, font_path, timeline, item, profile, bounds, font, pad, relative_frame=None):
|
|
86
|
+
name, kind = identity(profile), profile["component_id"]
|
|
87
|
+
hero = kind in HERO
|
|
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"]
|
|
92
|
+
relative = entry if relative_frame is None else relative_frame
|
|
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)))
|
|
96
|
+
x, y, right, bottom = bounds
|
|
97
|
+
width, height = right - x, bottom - y
|
|
98
|
+
primary, _, detail = item.text.partition("\n")
|
|
99
|
+
lines = _lines(primary, name, kind)
|
|
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")
|
|
104
|
+
|
|
105
|
+
def color(key, opacity=1):
|
|
106
|
+
r, g, b, a = palette[key]
|
|
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":
|
|
160
|
+
# An open notebook margin, graphite handwriting and an uneven marker.
|
|
161
|
+
text_fill = "ink"
|
|
162
|
+
rule((x + pad * 0.4, y + pad, x + pad * 0.4, bottom - pad), "accent")
|
|
163
|
+
for n in range(3):
|
|
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")
|
|
167
|
+
for n, value in enumerate(lines):
|
|
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":
|
|
190
|
+
# Printed editorial column, boxed kicker and staggered typographic rows.
|
|
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":
|
|
198
|
+
# Small serif lockup and a single expanding hairline: no box.
|
|
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":
|
|
204
|
+
# Offset neon frame, cyan glyph edge and vertical index ticks.
|
|
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")
|
|
212
|
+
for n in range(4):
|
|
213
|
+
rule((right - pad * 0.7, y + pad * (1 + n * 0.7), right - pad * 0.3, y + pad * (1 + n * 0.7)), "secondary")
|
|
214
|
+
label(kicker)
|
|
215
|
+
elif name == "food":
|
|
216
|
+
# A scalloped menu seal, red/yellow plates and bold reaction lettering.
|
|
217
|
+
pts = []
|
|
218
|
+
for n in range(40):
|
|
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":
|
|
234
|
+
# A clipped, industrial mission placard with diagonal hazard marks.
|
|
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
|
+
)
|
|
240
|
+
for n in range(5):
|
|
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)
|
|
244
|
+
# No fabricated timers, scores or progress counters in the overlay.
|
|
245
|
+
label(kicker, x + pad * 5, y + pad * 0.4, "secondary")
|
|
246
|
+
text_fill = "accent"
|
|
247
|
+
elif name == "coffee":
|
|
248
|
+
# A letterpress cafe docket: serif text, receipt edge, fine menu rules.
|
|
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":
|
|
263
|
+
# A rounded speech bubble and a hand-drawn sun, distinct from a ticket.
|
|
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
|
+
)
|
|
268
|
+
label(kicker)
|
|
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":
|
|
273
|
+
# Survey plate with topographic contour lines and an expedition rail.
|
|
274
|
+
draw.rectangle((x, y, right, bottom), fill=color("ink", 0.90))
|
|
275
|
+
for n in range(4):
|
|
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")
|
|
288
|
+
outlined = True
|
|
289
|
+
elif name == "portrait":
|
|
290
|
+
# Documentary pull quote, asymmetrical red rule and quiet attribution.
|
|
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":
|
|
297
|
+
# Railway ticket with punch holes, double border and a perforated stub.
|
|
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"
|
|
310
|
+
else: # tech: no diagonal comic banner, only a measured spec interface.
|
|
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"
|
|
320
|
+
|
|
321
|
+
for n, value in enumerate(lines):
|
|
322
|
+
local = min(1.0, max(0.0, p * 1.5 - n * 0.28))
|
|
323
|
+
if not local:
|
|
324
|
+
continue
|
|
325
|
+
# Each package has a different entrance grammar while the final text
|
|
326
|
+
# and all transient strokes remain inside the measured footprint.
|
|
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
|
|
336
|
+
text((tx, ty), value, font, text_fill, outlined)
|
|
337
|
+
if detail:
|
|
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")
|
|
350
|
+
return bounds
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"""Original broadcast graphics: bounded layouts and frame-driven entrance motion."""
|
|
2
|
+
|
|
3
|
+
import math
|
|
4
|
+
|
|
5
|
+
from .program_styles import (
|
|
6
|
+
draw_style_text,
|
|
7
|
+
draw_styled_graphic,
|
|
8
|
+
load_style_font,
|
|
9
|
+
skin,
|
|
10
|
+
style_font,
|
|
11
|
+
styled_text_length,
|
|
12
|
+
type_outline,
|
|
13
|
+
)
|
|
14
|
+
from .titles import TitleRenderError
|
|
15
|
+
|
|
16
|
+
# Each family owns its composition, rather than stretching the small label style.
|
|
17
|
+
FAMILIES = {
|
|
18
|
+
"program_title": (0.125, 0.80, 0.29, 24, 8),
|
|
19
|
+
"headline": (0.135, 0.82, 0.24, 20, 7),
|
|
20
|
+
"impact": (0.145, 0.74, 0.27, 16, 6),
|
|
21
|
+
"chapter": (0.075, 0.78, 0.18, 22, 8),
|
|
22
|
+
"burst": (0.108, 0.62, 0.27, 20, 6),
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def motion_frames(kind, profile=None):
|
|
27
|
+
appearance = (profile or {}).get("presets", {}).get("appearance", {})
|
|
28
|
+
return (
|
|
29
|
+
appearance.get("hero_entry_frames", FAMILIES[kind][3]),
|
|
30
|
+
appearance.get("hero_exit_frames", FAMILIES[kind][4]),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def layout(draw, font_path, timeline, item, profile):
|
|
35
|
+
if skin(profile) == "studio":
|
|
36
|
+
from .program_studio import layout as studio_layout
|
|
37
|
+
|
|
38
|
+
return studio_layout(draw, font_path, timeline, item, profile)
|
|
39
|
+
scale, max_width, height, _, _ = FAMILIES[profile["component_id"]]
|
|
40
|
+
font_path = style_font(font_path, profile)
|
|
41
|
+
scale *= profile["presets"].get("appearance", {}).get("hero_scale", 1.0)
|
|
42
|
+
w, h = timeline.width, timeline.height
|
|
43
|
+
x, y = round(w * profile["x"]), round(h * profile["y"])
|
|
44
|
+
pad = max(8, round(h * 0.025))
|
|
45
|
+
primary, _, detail = item.text.partition("\n")
|
|
46
|
+
limit = min(w * max_width, w * 0.945 - x)
|
|
47
|
+
size = max(14, round(h * scale))
|
|
48
|
+
minimum = max(14, round(h * scale * 0.70))
|
|
49
|
+
while True:
|
|
50
|
+
font = load_style_font(font_path, size, profile)
|
|
51
|
+
# Room for outline, shadow, skew and framing, including transient motion.
|
|
52
|
+
width = styled_text_length(primary, font) + pad * 4
|
|
53
|
+
if width <= limit or size <= minimum:
|
|
54
|
+
break
|
|
55
|
+
size -= 1
|
|
56
|
+
small = load_style_font(font_path, max(12, round(h * 0.027)), profile, role="detail")
|
|
57
|
+
width = max(width, styled_text_length(detail, small) + pad * 4 if detail else 0, w * 0.30)
|
|
58
|
+
bottom = y + round(h * height)
|
|
59
|
+
if width > limit or bottom > h * 0.77:
|
|
60
|
+
raise TitleRenderError("program_component_overflow")
|
|
61
|
+
return (x, y, x + math.ceil(width), bottom), font, pad
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def draw_motion_graphic(draw, font_path, timeline, item, profile, relative_frame=None):
|
|
65
|
+
bounds, font, pad = layout(draw, font_path, timeline, item, profile)
|
|
66
|
+
if skin(profile) != "variety":
|
|
67
|
+
return draw_styled_graphic(draw, font_path, timeline, item, profile, bounds, font, pad, relative_frame)
|
|
68
|
+
kind = profile["component_id"]
|
|
69
|
+
entry, exit_frames = motion_frames(kind, profile)
|
|
70
|
+
relative = entry if relative_frame is None else relative_frame
|
|
71
|
+
progress = min(1.0, max(0.0, (relative + 1) / entry))
|
|
72
|
+
ease = 1 - (1 - progress) ** 3
|
|
73
|
+
opacity = min(1.0, max(0.0, (item.duration_frames - relative) / exit_frames))
|
|
74
|
+
palette = profile["presets"]["palette"]
|
|
75
|
+
|
|
76
|
+
def color(name, alpha=1.0):
|
|
77
|
+
r, g, b, a = palette[name]
|
|
78
|
+
return r, g, b, round(a * opacity * alpha)
|
|
79
|
+
|
|
80
|
+
x, y, right, bottom = bounds
|
|
81
|
+
width, height = right - x, bottom - y
|
|
82
|
+
stroke = max(2, round(timeline.height * 0.004))
|
|
83
|
+
primary, _, detail = item.text.partition("\n")
|
|
84
|
+
small = load_style_font(font_path, max(12, round(timeline.height * 0.027)), profile, role="detail")
|
|
85
|
+
kicker = load_style_font(font_path, max(10, round(timeline.height * 0.020)), profile, role="detail")
|
|
86
|
+
|
|
87
|
+
def text(position, value, *, fill="paper", selected_font=font, outline=True):
|
|
88
|
+
draw_style_text(
|
|
89
|
+
draw,
|
|
90
|
+
position,
|
|
91
|
+
value,
|
|
92
|
+
selected_font,
|
|
93
|
+
color(fill),
|
|
94
|
+
type_outline(profile, selected_font, stroke * 2) if outline else 0,
|
|
95
|
+
color("ink"),
|
|
96
|
+
)
|
|
97
|
+
# Embolden the glyph itself; CJK collections may expose a light default face.
|
|
98
|
+
if not profile["presets"].get("font_roles"):
|
|
99
|
+
draw_style_text(
|
|
100
|
+
draw,
|
|
101
|
+
position,
|
|
102
|
+
value,
|
|
103
|
+
selected_font,
|
|
104
|
+
color(fill),
|
|
105
|
+
max(1, stroke // 2) if selected_font is font else 0,
|
|
106
|
+
color(fill),
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
if kind == "program_title":
|
|
110
|
+
# Two framing strokes reveal first; the title rises into the open frame.
|
|
111
|
+
reveal = width * ease
|
|
112
|
+
draw.rectangle((x, y, x + reveal, y + stroke * 2), fill=color("accent"))
|
|
113
|
+
draw.rectangle((right - reveal, bottom - stroke, right, bottom), fill=color("secondary"))
|
|
114
|
+
draw.rectangle((x, y + stroke * 2, x + stroke, bottom), fill=color("accent", ease))
|
|
115
|
+
draw.rectangle(
|
|
116
|
+
(x + pad, y + pad * 0.5, x + pad + max(width * 0.25, timeline.width * 0.16) * ease, y + pad * 2.0),
|
|
117
|
+
fill=color("accent"),
|
|
118
|
+
)
|
|
119
|
+
draw.text((x + pad * 1.2, y + pad * 0.74), "ON LOCATION", font=kicker, fill=color("ink"), anchor="lt")
|
|
120
|
+
tx, ty = x + pad * 1.4, y + height * 0.32 + (1 - ease) * pad
|
|
121
|
+
text((tx + stroke * 2, ty + stroke * 2), primary, fill="ink")
|
|
122
|
+
text((tx, ty), primary)
|
|
123
|
+
elif kind == "headline":
|
|
124
|
+
# Word-sized punches arrive left-to-right over an expanding slanted band.
|
|
125
|
+
band_y = y + height * 0.10
|
|
126
|
+
draw.polygon(
|
|
127
|
+
[
|
|
128
|
+
(x, band_y + height * 0.12),
|
|
129
|
+
(x + width * ease, band_y),
|
|
130
|
+
(x + width * ease - pad, y + height * 0.76),
|
|
131
|
+
(x, y + height * 0.76),
|
|
132
|
+
],
|
|
133
|
+
fill=color("accent"),
|
|
134
|
+
)
|
|
135
|
+
cursor = x + pad * 1.5
|
|
136
|
+
for n, char in enumerate(primary):
|
|
137
|
+
local = min(1.0, max(0.0, progress * 1.8 - n / max(1, len(primary)) * 0.8))
|
|
138
|
+
if local:
|
|
139
|
+
text((cursor, y + height * 0.19 + (1 - local) ** 2 * pad), char, fill="ink", outline=False)
|
|
140
|
+
cursor += draw.textlength(char, font=font)
|
|
141
|
+
elif kind == "impact":
|
|
142
|
+
# A slam contracts from a displaced shadow into solid outlined type.
|
|
143
|
+
hit = min(1.0, progress * 1.8)
|
|
144
|
+
tx, ty = x + pad * 2, y + height * 0.20
|
|
145
|
+
offset = round((1 - hit) * pad * 1.5) + stroke * 2
|
|
146
|
+
text((tx + offset, ty + offset), primary, fill="secondary")
|
|
147
|
+
text((tx, ty), primary, fill="accent")
|
|
148
|
+
for side in (-1, 1):
|
|
149
|
+
edge = x + pad * 0.8 if side < 0 else right - pad * 0.8
|
|
150
|
+
draw.line(
|
|
151
|
+
(edge, y + height * 0.2, edge + side * pad * 0.5 * ease, y + height * 0.05),
|
|
152
|
+
fill=color("accent"),
|
|
153
|
+
width=stroke * 2,
|
|
154
|
+
)
|
|
155
|
+
draw.line(
|
|
156
|
+
(edge, y + height * 0.48, edge + side * pad * 0.5 * ease, y + height * 0.56),
|
|
157
|
+
fill=color("paper"),
|
|
158
|
+
width=stroke,
|
|
159
|
+
)
|
|
160
|
+
elif kind == "chapter":
|
|
161
|
+
# A tab and panel wipe establish a new segment while footage stays visible.
|
|
162
|
+
end = x + width * ease
|
|
163
|
+
draw.polygon([(x, y), (end, y), (end - pad, y + height * 0.78), (x, y + height * 0.78)], fill=color("ink"))
|
|
164
|
+
draw.rectangle((x, y, x + pad * 0.65, y + height * 0.78), fill=color("secondary"))
|
|
165
|
+
draw.line((x + pad, bottom - stroke, x + width * ease, bottom - stroke), fill=color("accent"), width=stroke * 2)
|
|
166
|
+
if progress > 0.28:
|
|
167
|
+
text((x + pad * 1.5, y + height * 0.16), primary)
|
|
168
|
+
else: # burst: an angular outlined badge with outward growing rays.
|
|
169
|
+
cx, cy = (x + right) / 2, y + height * 0.43
|
|
170
|
+
rx, ry = width * 0.44 * ease, height * 0.39 * ease
|
|
171
|
+
points = []
|
|
172
|
+
for n in range(20):
|
|
173
|
+
angle = math.tau * n / 20
|
|
174
|
+
radius = 1.0 if n % 2 == 0 else 0.80
|
|
175
|
+
points.append((cx + math.cos(angle) * rx * radius, cy + math.sin(angle) * ry * radius))
|
|
176
|
+
draw.polygon(points, fill=color("ink"), outline=color("accent"), width=stroke * 2)
|
|
177
|
+
if progress > 0.35:
|
|
178
|
+
text((x + pad * 2, y + height * 0.27), primary, fill="accent")
|
|
179
|
+
for angle in (0, math.pi * 0.20, math.pi * 0.80, math.pi):
|
|
180
|
+
start = (cx + math.cos(angle) * width * 0.46, cy + math.sin(angle) * height * 0.44)
|
|
181
|
+
end = (start[0] + math.cos(angle) * pad * 0.6 * ease, start[1] + math.sin(angle) * pad * 0.5 * ease)
|
|
182
|
+
draw.line((start, end), fill=color("secondary"), width=stroke * 2)
|
|
183
|
+
if detail:
|
|
184
|
+
# Secondary line has reserved space; never lies on top of the main title.
|
|
185
|
+
text((x + pad * 1.5, bottom - pad * 1.9), detail, selected_font=small)
|
|
186
|
+
return bounds
|