Files
OrbitTv/design/channels/build-network-brands.py
T
pauljdandClaude Opus 5.5 4c0c165069
pauljd/davidson-ci: Davidson CI / quality (push) Failing after 1m48s
pauljd/davidson-ci: Davidson CI / ai-review (push) Successful in 47s
Add original branding proofs for six channels
Ring X, Riot, Odyssey, Terra, Dark Files and PixelZ, redrawn from Paul's
concept boards using the After Dark workflow: editable VectorCraft logos,
layered PhotoCraft backgrounds, EffectCraft idents and FigCraft review
sheets, all rebuilt by one script. Design proofs only; nothing is added
to the app. Adds Anton and Comfortaa, both under the SIL OFL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-01 18:11:14 +00:00

624 lines
50 KiB
Python

#!/usr/bin/env python3
"""Original Orbit channel branding, built the After Dark way from the concept boards.
Writes editable SVG sources, then uses the installed Craft CLIs for native VectorCraft,
PhotoCraft, FigCraft and EffectCraft files. Existing channel folders are never touched.
build-network-brands.py [--static] [channel ...]
"""
from pathlib import Path
import html, json, math, os, random, shutil, subprocess, sys
from PIL import Image
HERE = Path(__file__).resolve().parent
ROOT = HERE.parent.parent
ENV = dict(os.environ, XDG_DATA_HOME=str(ROOT / '.tooling/font-data'))
NAVY, PANEL, BLUE, FOCUS, MUTED = '#071632', '#12356B', '#194C91', '#FFDE59', '#B7CBE8'
BARLOW, CONDENSED, ANTON, ROUND = 'Barlow', 'Barlow Condensed', 'Anton', 'Comfortaa'
def svg(w, h, body):
return f'<svg xmlns="http://www.w3.org/2000/svg" width="{w}" height="{h}" viewBox="0 0 {w} {h}">{body}</svg>'
def text(x, y, value, size, fill='white', family=BARLOW, weight='400', extra=''):
return f'<text x="{x}" y="{y}" font-family="{family}" font-size="{size}" font-weight="{weight}" fill="{fill}" {extra}>{html.escape(value)}</text>'
def stops(*pairs):
return ''.join(f'<stop offset="{o}" stop-color="{c}"' + (f' stop-opacity="{a[0]}"' if a else '') + '/>' for o, c, *a in pairs)
def vgrad(name, *pairs):
return f'<linearGradient id="{name}" x1="0" y1="0" x2="0" y2="1">{stops(*pairs)}</linearGradient>'
def rgrad(name, *pairs):
return f'<radialGradient id="{name}">{stops(*pairs)}</radialGradient>'
SILVER = vgrad('silver', (0, '#FFFFFF'), (.44, '#E8EDF5'), (.5, '#B7CBE8'), (1, '#F5F7FF'))
CRESCENT = 'M335 132C141 114 66 384 257 475C143 363 185 207 335 132Z'
def crescent(fill='url(#silver)'):
return f'<path d="{CRESCENT}" fill="{fill}"/>'
def ring(colour, width=11):
"""The family's orbital line: the same path as After Dark, in the channel's accent."""
return (f'<path d="M129 369C102 399 111 425 161 428C267 432 431 340 445 289C455 250 405 250 369 261" fill="none" stroke="{colour}" stroke-width="{width}"/>'
f'<circle cx="430" cy="282" r="9" fill="{colour}"/>')
def skyline(seed, base='#061025', lit='#FFDE59', low=70, high=220):
rng, lamps = random.Random(seed), random.Random(seed + 7)
x, d, windows = 0, 'M0 1080V900', ''
while x < 1920:
w, h = rng.randint(35, 85), rng.randint(low, high)
d += f'H{x}V{1080 - h}H{x + w}V1080'
if lamps.random() > .2:
for wy in range(1080 - h + 12, 1069, 18):
for wx in range(x + 9, min(x + w - 7, 1912), 14):
if lamps.random() < .24:
windows += f'<rect x="{wx}" y="{wy}" width="4" height="7" fill="{lit}" opacity="{lamps.choice([.35, .5, .7])}"/>'
x += w + rng.randint(5, 18)
return f'<path d="{d}H1920Z" fill="{base}"/>{windows}'
def stars(seed, count=70, colour=MUTED, y1=720):
rng = random.Random(seed)
return ''.join(f'<circle cx="{rng.randrange(30, 1890)}" cy="{rng.randrange(30, y1)}" r="{rng.choice([1, 1, 1.5, 2])}" fill="{colour}" opacity="{rng.choice([.35, .5, .75])}"/>' for _ in range(count))
def jagged(points, seed, amount=9, step=26):
"""A torn edge: subdivide each side and nudge the points, so no two tears match."""
rng, out = random.Random(seed), []
for (x1, y1), (x2, y2) in zip(points, points[1:] + points[:1]):
n = max(1, int(math.hypot(x2 - x1, y2 - y1) / step))
for i in range(n):
t = i / n
out.append((round(x1 + (x2 - x1) * t + rng.uniform(-amount, amount)), round(y1 + (y2 - y1) * t + rng.uniform(-amount, amount))))
return ' '.join(f'{x},{y}' for x, y in out)
def halftone(x0, y0, cols, rows, gap, colour, seed=1, opacity=.8):
"""Dots shrink away from the patch's centre."""
out = ''
for r in range(rows):
for c in range(cols):
d = math.hypot((c - cols / 2) / (cols / 2), (r - rows / 2) / (rows / 2))
if d < 1:
out += f'<circle cx="{x0 + c * gap + (r % 2) * gap / 2:.0f}" cy="{y0 + r * gap}" r="{(1 - d) * gap * .46:.1f}" fill="{colour}" opacity="{opacity}"/>'
return out
def checker(x, y, cols, rows, size, angle=0, a='#F7F7F7', b='#0B0E16'):
cells = ''.join(f'<rect x="{c * size}" y="{r * size}" width="{size}" height="{size}" fill="{a if (c + r) % 2 else b}"/>' for r in range(rows) for c in range(cols))
return f'<g transform="translate({x},{y}) rotate({angle})">{cells}</g>'
def bolt(x, y, scale, colour):
return f'<polygon transform="translate({x},{y}) scale({scale})" points="60,0 10,95 48,95 22,190 110,70 66,70 96,0" fill="{colour}"/>'
def burst(cx, cy, r1, r2, points, colour, opacity=1):
pts = []
for i in range(points * 2):
r, a = (r1 if i % 2 else r2), math.pi * i / points - math.pi / 2
pts.append(f'{cx + r * math.cos(a):.0f},{cy + r * math.sin(a):.0f}')
return f'<polygon points="{" ".join(pts)}" fill="{colour}" opacity="{opacity}"/>'
def cube(x, y, s, top, left, right):
"""An isometric cube whose top corner sits at (x, y)."""
w, h = s * .87, s * .5
return (f'<polygon points="{x:.0f},{y:.0f} {x + w:.0f},{y + h:.0f} {x:.0f},{y + 2 * h:.0f} {x - w:.0f},{y + h:.0f}" fill="{top}"/>'
f'<polygon points="{x - w:.0f},{y + h:.0f} {x:.0f},{y + 2 * h:.0f} {x:.0f},{y + 2 * h + s:.0f} {x - w:.0f},{y + h + s:.0f}" fill="{left}"/>'
f'<polygon points="{x + w:.0f},{y + h:.0f} {x:.0f},{y + 2 * h:.0f} {x:.0f},{y + 2 * h + s:.0f} {x + w:.0f},{y + h + s:.0f}" fill="{right}"/>')
def spotlight(x, y, reach, spread, colour, name):
"""A beam that fades out along its length. Gradients, so no filters are needed."""
return (f'<defs><linearGradient id="{name}" gradientUnits="userSpaceOnUse" x1="{x}" y1="{y}" x2="{x + reach[0]}" y2="{y + reach[1]}">{stops((0, colour, .62), (1, colour, 0))}</linearGradient></defs>'
f'<polygon points="{x - 8},{y} {x + 8},{y} {x + reach[0] + spread},{y + reach[1]} {x + reach[0] - spread},{y + reach[1]}" fill="url(#{name})"/>'
f'<circle cx="{x}" cy="{y}" r="17" fill="#E9F1FF"/><circle cx="{x}" cy="{y}" r="28" fill="{colour}" opacity=".35"/>')
def truss(x1, y1, x2, y2, depth=46, colour='#8C9AB3', opacity=.7, step=52):
"""A steel truss: two chords and a zig-zag between them."""
length = math.hypot(x2 - x1, y2 - y1)
ux, uy = (x2 - x1) / length, (y2 - y1) / length
nx, ny = -uy * depth, ux * depth
zig = []
for i in range(int(length / step) + 1):
d = i * step
px, py = x1 + ux * d, y1 + uy * d
zig.append(f'{px + (nx if i % 2 else 0):.0f},{py + (ny if i % 2 else 0):.0f}')
return (f'<g opacity="{opacity}" fill="none" stroke="{colour}"><line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" stroke-width="6"/>'
f'<line x1="{x1 + nx:.0f}" y1="{y1 + ny:.0f}" x2="{x2 + nx:.0f}" y2="{y2 + ny:.0f}" stroke-width="6"/>'
f'<polyline points="{" ".join(zig)}" stroke-width="3"/></g>')
def word_chrome():
return vgrad('chrome', (0, '#FFFFFF'), (.34, '#C9CDD6'), (.5, '#5E6675'), (.56, '#E6EAF1'), (1, '#8E96A6'))
def ring_x():
defs = '<defs>' + SILVER + word_chrome() + vgrad('red', (0, '#FF4A55'), (.55, '#F0142F'), (1, '#8E0B1C')) + '</defs>'
mark = defs + crescent() + ring('#F0142F')
orbit = text(486, 150, 'ORBIT', 50, '#C9CDD6', BARLOW, '600', 'letter-spacing="14"')
word = f'<g transform="skewX(-9)">' + text(530, 438, 'RING', 280, 'url(#chrome)', ANTON, '400', 'letter-spacing="10"') + '</g>'
# The X is drawn, not typed: a slashed cross cut at angles, so it can't be mistaken for Orbit X's brushstroke.
x = ('<polygon points="1040,118 1236,118 1302,232 1416,118 1560,118 1378,312 1492,520 1296,520 1236,404 1116,520 968,520 1160,318" fill="url(#red)"/>'
'<polygon points="1040,118 1236,118 1302,232 1280,256 1208,142 1090,142 1192,318 1020,496 968,520 1160,318" fill="#FFFFFF" opacity=".28"/>')
sweep = '<path d="M452 560C700 598 1000 570 1206 522L1190 546C980 600 660 622 452 560Z" fill="#F0142F"/>'
parts = [('crescent', mark), ('orbit', defs + orbit), ('word', defs + word), ('accent', defs + f'<g transform="translate(-50,0)">{x}</g>'), ('sweep', defs + sweep)]
epg = defs + f'<g transform="translate(-5,1) scale(.26)">{crescent()}{ring("#F0142F")}</g>' + text(134, 50, 'ORBIT', 18, '#C9CDD6', BARLOW, '600', 'letter-spacing="5"') + text(134, 128, 'RING', 74, 'url(#chrome)', ANTON) + f'<g transform="translate(-6,10) scale(.27)">{x}</g>'
bug = defs + f'<g transform="translate(-7,-8) scale(.22)">{crescent("#FFFFFF")}{ring("#F0142F")}</g>' + text(112, 100, 'RING', 82, '#FFFFFF', ANTON, '400', 'stroke="#071632" stroke-width="2"') + f'<g transform="translate(-20,-8) scale(.24)">{x}</g>'
arena = ('<defs>' + vgrad('hall', (0, '#050812'), (.6, '#0A1226'), (1, '#0A0E1E')) + rgrad('floorglow', (0, '#F0142F', .42), (1, '#F0142F', 0)) + rgrad('blueglow', (0, '#1E6FFF', .34), (1, '#1E6FFF', 0)) + '</defs>'
'<rect width="1920" height="1080" fill="url(#hall)"/><ellipse cx="520" cy="860" rx="720" ry="330" fill="url(#floorglow)"/><ellipse cx="1420" cy="860" rx="720" ry="330" fill="url(#floorglow)"/><ellipse cx="960" cy="240" rx="900" ry="330" fill="url(#blueglow)"/>')
rig = truss(0, 110, 1920, 110) + truss(330, 150, 330, 900) + truss(1590, 150, 1590, 900) + truss(0, 340, 300, 150, 40, '#8C9AB3', .4) + truss(1920, 340, 1620, 150, 40, '#8C9AB3', .4)
screen = '<rect x="470" y="220" width="980" height="520" fill="#0A0E1E" stroke="#8C9AB3" stroke-width="5"/>' + ''.join(f'<line x1="{470 + i * 40}" y1="222" x2="{430 + i * 40 + 40}" y2="738" stroke="#1B2233" stroke-width="2" opacity=".55"/>' for i in range(1, 25))
floor = ('<polygon points="620,760 1300,760 1860,1080 60,1080" fill="#0E1730"/>' + ''.join(f'<line x1="{620 + i * 68}" y1="760" x2="{60 + i * 186}" y2="1080" stroke="#1E6FFF" stroke-width="2" opacity=".28"/>' for i in range(11)) +
'<polygon points="620,760 640,760 240,1080 180,1080" fill="#F0142F" opacity=".7"/><polygon points="1300,760 1280,760 1680,1080 1740,1080" fill="#F0142F" opacity=".7"/>')
rng = random.Random(24)
crowd = ''
x_ = -20
while x_ < 1960:
h = rng.randint(120, 200)
if 470 < x_ < 1420:
h -= 95
crowd += f'<circle cx="{x_}" cy="{1080 - h}" r="{rng.randint(22, 30)}" fill="#03050C"/><rect x="{x_ - 36}" y="{1080 - h + 20}" width="72" height="{h}" rx="20" fill="#03050C"/>'
if rng.random() < .42:
crowd += f'<rect x="{x_ + 16}" y="{1080 - h - 92}" width="15" height="118" rx="7" fill="#03050C" transform="rotate({rng.randint(-16, 16)} {x_ + 23} {1080 - h})"/>'
x_ += rng.randint(48, 78)
sparks = ''.join(f'<circle cx="{rng.randrange(40, 1880)}" cy="{rng.randrange(240, 860)}" r="{rng.choice([1.5, 2, 3])}" fill="{rng.choice(["#FF8A3C", "#FF4A55", "#FFD08A"])}" opacity="{rng.choice([.45, .7, .9])}"/>' for _ in range(70))
beams = [(150, 120, (360, 760), 150, '#1E6FFF'), (560, 120, (-120, 760), 130, '#F0142F'), (800, 120, (120, 760), 130, '#1E6FFF'), (1120, 120, (-120, 760), 130, '#1E6FFF'), (1360, 120, (120, 760), 130, '#F0142F'), (1770, 120, (-360, 760), 150, '#1E6FFF')]
lights = [(f'beam_{i + 1}', spotlight(*b[:2], b[2], b[3], b[4], f'beam{i}')) for i, b in enumerate(beams)]
layers = [('arena', arena), ('rig', rig + screen + floor)] + lights + [('sparks', sparks), ('crowd', crowd)]
return dict(id='orbit-ring-x', name='Ring X', tag='Wrestling television and events', palette=[('Ring red', '#F0142F'), ('Chrome', '#C9CDD6'), ('Electric blue', '#1E6FFF'), ('Arena black', '#0A0E1E')],
accent='#F0142F', parts=parts, epg=epg, bug=bug, layers=layers, background='#0A0E1E', base=['arena', 'rig', 'crowd'],
motion=[(f'beam_{i + 1}', .25 + i * .2) for i in range(6)] + [('sparks', 1.5)], trail=([[150, 610], [1140, 430]], [[0, 0], [-260, 120]], [[260, 60], [0, 0]]),
reveal=[('crescent', 2.3, 'fade'), ('orbit', 2.42, 'fade'), ('word', 2.42, 'rise'), ('sweep', 2.5, 'fade'), ('accent', 2.72, 'slam')], note='Arena lights come up one by one, a red line draws, the metal lettering forms, then the red X lands. No strobing: each light ramps over 0.4 s.')
def riot():
defs = '<defs>' + SILVER + '</defs>'
paper = (f'<polygon points="{jagged([(440, 120), (1296, 72), (1336, 470), (500, 524)], 3, 13)}" fill="#D7FF00"/>')
pink = (f'<polygon points="{jagged([(420, 300), (1370, 330), (1340, 570), (452, 570)], 5, 15)}" fill="#FF2EA6"/>')
dots = halftone(180, 330, 24, 16, 15, '#A84DFF') + halftone(1020, 30, 24, 10, 15, '#FF2EA6')
word = text(478, 470, 'RIOT', 350, '#0B0E16', ANTON, '400', 'letter-spacing="30" transform="rotate(-3 900 300)"')
mark = defs + crescent('#F7F7F7') + ring('#FF2EA6')
orbit = text(520, 104, 'ORBIT', 50, '#F7F7F7', BARLOW, '600', 'letter-spacing="14" transform="rotate(-3 620 100)"')
crown = '<path d="M1240 40L1262 -8L1302 26L1344 -18L1360 40Z" transform="translate(-110,20)" fill="none" stroke="#F7F7F7" stroke-width="9" stroke-linejoin="round"/>'
ticks = '<path d="M1366 118L1424 78M1376 178L1448 168M1356 62L1386 24" stroke="#D7FF00" stroke-width="13" stroke-linecap="round"/>'
strip = checker(640, 545, 26, 3, 19, -2)
sweep = '<path d="M470 618C760 640 1110 620 1380 566" fill="none" stroke="#FF2EA6" stroke-width="8"/>'
parts = [('dots', dots), ('pink', pink), ('paper', paper), ('crescent', mark), ('word', word), ('orbit', orbit), ('accent', crown + ticks + strip), ('sweep', sweep)]
epg = defs + f'<g transform="translate(-5,1) scale(.26)">{crescent("#F7F7F7")}{ring("#FF2EA6")}</g>' + f'<polygon points="{jagged([(132, 62), (348, 52), (358, 146), (138, 152)], 8, 4, 18)}" fill="#D7FF00"/>' + text(134, 42, 'ORBIT', 20, '#F7F7F7', BARLOW, '600', 'letter-spacing="5"') + text(144, 140, 'RIOT', 82, '#0B0E16', ANTON, '400', 'letter-spacing="9"')
bug = defs + f'<g transform="translate(-7,-8) scale(.22)">{crescent("#F7F7F7")}{ring("#FF2EA6")}</g>' + f'<polygon points="{jagged([(104, 16), (330, 8), (336, 120), (108, 124)], 9, 4, 18)}" fill="#D7FF00"/>' + text(122, 112, 'RIOT', 96, '#0B0E16', ANTON, '400', 'letter-spacing="9"')
sky = '<defs>' + vgrad('riotsky', (0, '#0B0E2A'), (.55, '#3A1A78'), (1, '#6A1FA8')) + '</defs><rect width="1920" height="1080" fill="url(#riotsky)"/>'
torn = (f'<polygon points="{jagged([(-20, 130), (720, 200), (660, 330), (-20, 270)], 11, 11)}" fill="#F7F7F7"/>' + f'<polygon points="{jagged([(1240, 700), (1940, 560), (1940, 900), (1270, 950)], 12, 13)}" fill="#FF2EA6"/>' +
f'<polygon points="{jagged([(300, 300), (1620, 250), (1600, 840), (330, 880)], 13, 15)}" fill="#FF2EA6"/>' + halftone(60, 480, 36, 24, 18, '#A84DFF', opacity=.9) + halftone(1300, 40, 36, 20, 18, '#00E5FF', opacity=.7))
rng = random.Random(77)
tv = ('<rect x="520" y="210" width="880" height="660" rx="60" fill="#2A1830"/><rect x="520" y="210" width="880" height="660" rx="60" fill="none" stroke="#120A18" stroke-width="10"/>'
'<rect x="570" y="262" width="640" height="550" rx="46" fill="#0B0E16"/>'
'<circle cx="1306" cy="360" r="46" fill="#120A18"/><circle cx="1306" cy="360" r="28" fill="#6C5A70"/><circle cx="1306" cy="500" r="46" fill="#120A18"/><circle cx="1306" cy="500" r="28" fill="#6C5A70"/>' +
''.join(f'<rect x="1262" y="{610 + i * 24}" width="88" height="10" fill="#120A18"/>' for i in range(6)))
static = ''.join(f'<rect x="{rng.randrange(586, 1190)}" y="{rng.randrange(280, 790)}" width="{rng.randint(6, 34)}" height="3" fill="{rng.choice(["#F7F7F7", "#9AA0AC", "#5B606C"])}" opacity="{rng.choice([.4, .6, .85])}"/>' for _ in range(900))
shapes = [('burst', burst(960, 200, 78, 170, 9, '#00E5FF')), ('bolt_left', bolt(150, 330, 1.7, '#D7FF00')), ('bolt_right', bolt(1560, 290, 1.7, '#D7FF00')), ('strip', checker(20, 700, 22, 4, 26, -5))]
city = skyline(9, '#0B0E2A', '#FFDE59', 70, 170)
layers = [('sky', sky), ('torn', torn), ('city', city)] + shapes + [('tv', tv), ('static', static)]
return dict(id='orbit-riot', name='Riot', tag='Adult animation, sitcoms and alternative comedy', palette=[('Electric lime', '#D7FF00'), ('Hot pink', '#FF2EA6'), ('Cyan', '#00E5FF'), ('Orange', '#FF8A00'), ('Purple', '#A84DFF'), ('Near black', '#0B0E16')],
accent='#FF2EA6', parts=parts, epg=epg, bug=bug, layers=layers, background='#0B0E2A', base=['sky', 'torn', 'city', 'tv'],
motion=[('static', .1), ('burst', .9), ('bolt_left', 1.1), ('bolt_right', 1.25), ('strip', 1.4)], pop={'burst', 'bolt_left', 'bolt_right', 'strip'}, trail=([[180, 840], [1500, 640]], [[0, 0], [-300, 120]], [[320, 120], [0, 0]]),
scrim=False, reveal=[('dots', 1.9, 'fade'), ('pink', 2.0, 'slam'), ('paper', 2.15, 'slam'), ('crescent', 2.3, 'fade'), ('word', 2.4, 'slam'), ('orbit', 2.55, 'fade'), ('accent', 2.7, 'slam'), ('sweep', 2.8, 'fade')],
note='Static on a retro TV, graphic shapes burst in, then the logo assembles as a collage. The static holds steady rather than flickering, to stay clear of flashing.')
def odyssey():
gold = vgrad('gold', (0, '#FFE9A8'), (1, '#E9B44C'))
defs = '<defs>' + SILVER + gold + '</defs>'
star = '<path d="M430 240L442 276L478 288L442 300L430 336L418 300L382 288L418 276Z" fill="url(#gold)"/>'
mark = defs + crescent() + '<path d="M129 369C102 399 111 425 161 428C267 432 431 340 445 289" fill="none" stroke="url(#gold)" stroke-width="10"/>'
orbit = text(510, 180, 'ORBIT', 56, '#D6E2F3', BARLOW, '600', 'letter-spacing="24"')
word = text(486, 440, 'ODYSSEY', 268, 'url(#silver)', CONDENSED, '500', 'letter-spacing="12"')
sweep = '<path d="M470 510C760 560 1140 540 1480 450C1200 580 760 610 470 510Z" fill="url(#gold)"/>'
parts = [('crescent', mark), ('orbit', defs + orbit), ('word', defs + word), ('accent', defs + star), ('sweep', defs + sweep)]
small = f'<g transform="translate(-5,1) scale(.26)">{crescent()}<path d="M129 369C102 399 111 425 161 428C267 432 431 340 445 289" fill="none" stroke="url(#gold)" stroke-width="11"/>{star}</g>'
epg = defs + small + text(136, 52, 'ORBIT', 20, '#D6E2F3', BARLOW, '600', 'letter-spacing="9"') + text(134, 124, 'ODYSSEY', 78, '#F4F6FF', CONDENSED, '500', 'letter-spacing="3"')
bug = defs + f'<g transform="translate(-7,-8) scale(.22)">{crescent("#FFFFFF")}<path d="M129 369C102 399 111 425 161 428C267 432 431 340 445 289" fill="none" stroke="url(#gold)" stroke-width="13"/></g>' + text(106, 96, 'ODYSSEY', 88, '#FFFFFF', CONDENSED, '500', 'letter-spacing="2" stroke="#071632" stroke-width="2"')
sky = '<defs>' + vgrad('space', (0, '#030817'), (.7, '#07142E'), (1, '#0E3E7A')) + '</defs><rect width="1920" height="1080" fill="url(#space)"/>'
earth = ('<defs>' + rgrad('ocean', (.82, '#0A2F63'), (.97, '#0E5C8A'), (.995, '#138A8A'), (1, '#6FD3E8')) + '</defs><circle cx="960" cy="2820" r="2200" fill="url(#ocean)"/>')
rng = random.Random(41)
land = ''
for _ in range(30):
cx, cy = rng.randrange(40, 1880), rng.randrange(690, 1060)
cy = cy + (2200 - math.sqrt(max(0, 2200 ** 2 - (cx - 960) ** 2))) * .9
squash = .22 + (cy - 620) / 900
n, pts = 14, []
for t in range(n):
a = 2 * math.pi * t / n
radius = rng.uniform(.55, 1) * rng.randint(70, 170)
pts.append((cx + radius * 1.6 * math.cos(a), cy + radius * squash * math.sin(a)))
d = f'M{(pts[0][0] + pts[-1][0]) / 2:.0f} {(pts[0][1] + pts[-1][1]) / 2:.0f}'
for i, (px, py) in enumerate(pts):
nx_, ny_ = pts[(i + 1) % n]
d += f'Q{px:.0f} {py:.0f} {(px + nx_) / 2:.0f} {(py + ny_) / 2:.0f}'
land += f'<path d="{d}Z" fill="{rng.choice(["#1E6B57", "#2A7F5F", "#8C7A48", "#245F4E"])}" opacity=".62"/>'
grid = ''.join(f'<ellipse cx="960" cy="2820" rx="{r}" ry="2200" fill="none" stroke="#D6E2F3" stroke-width="1.5" opacity=".16"/>' for r in (240, 620, 1040, 1500, 1950)) + ''.join(f'<circle cx="960" cy="2820" r="{r}" fill="none" stroke="#D6E2F3" stroke-width="1.5" opacity=".16"/>' for r in (2020, 2090, 2150))
sun = '<defs>' + rgrad('sunrise', (0, '#FFF3C4', 1), (.28, '#FFC766', .72), (1, '#FFC766', 0)) + '</defs><ellipse cx="1240" cy="630" rx="760" ry="210" fill="url(#sunrise)"/><circle cx="960" cy="2820" r="2200" fill="none" stroke="#BDEBFF" stroke-width="7" opacity=".85"/>'
layers = [('space', sky + stars(31, 110)), ('earth', earth), ('land', land), ('grid', grid), ('sunrise', sun)]
return dict(id='orbit-odyssey', name='Odyssey', tag='Science, history, exploration', palette=[('Orbit navy', '#07142E'), ('Expedition blue', '#0E3E7A'), ('Atlantic teal', '#138A8A'), ('Orbit silver', '#D6E2F3'), ('Discovery gold', '#FFC766')],
accent='#FFC766', parts=parts, epg=epg, bug=bug, layers=layers, background='#07142E', base=['space', 'earth', 'land'],
motion=[('grid', .35), ('sunrise', .9)], trail=([[60, 500], [1640, 300]], [[0, 0], [-500, 40]], [[520, 120], [0, 0]]),
reveal=[('crescent', 2.3, 'fade'), ('orbit', 2.42, 'fade'), ('word', 2.42, 'rise'), ('sweep', 2.55, 'fade'), ('accent', 2.75, 'pop')], note='Sun rises over the Earth, a gold orbital line traces across it, then the logo appears with its discovery star.')
def terra():
green = vgrad('leaf', (0, '#9BE564'), (1, '#2F9E44'))
defs = '<defs>' + SILVER + green + rgrad('globe', (.1, '#4FB7E0'), (.72, '#123E7E'), (1, '#07142E')) + '</defs>'
globe = '<circle cx="232" cy="300" r="176" fill="url(#globe)"/><path d="M148 214C196 186 256 204 262 240C266 278 214 268 198 300C186 330 214 372 180 386C138 354 116 278 148 214Z" fill="#3E9B5C"/><path d="M296 300C330 288 372 316 368 356C348 392 306 420 284 416C290 376 270 332 296 300Z" fill="#3E9B5C"/><circle cx="232" cy="300" r="176" fill="none" stroke="#BDEBFF" stroke-width="5" opacity=".8"/>'
leaf = '<path d="M254 244C310 148 410 118 500 130C486 222 410 306 290 298C340 268 382 220 402 170C350 196 300 232 254 244Z" fill="url(#leaf)"/>'
orbit = text(556, 190, 'ORBIT', 56, '#E6F4EE', BARLOW, '600', 'letter-spacing="24"')
word = text(530, 440, 'TERRA', 290, '#FFFFFF', BARLOW, '600', 'letter-spacing="14"')
sweep = '<path d="M190 510C560 570 1020 560 1440 450C1120 590 560 620 190 510Z" fill="url(#leaf)"/>'
parts = [('globe', defs + globe), ('orbit', defs + orbit), ('word', defs + word), ('accent', defs + leaf), ('sweep', defs + sweep)]
small = f'<g transform="translate(-16,-14) scale(.32)">{globe}{leaf}</g>'
epg = defs + small + text(150, 52, 'ORBIT', 20, '#E6F4EE', BARLOW, '600', 'letter-spacing="9"') + text(148, 124, 'TERRA', 76, '#FFFFFF', BARLOW, '600', 'letter-spacing="3"')
bug = defs + f'<g transform="translate(-20,-22) scale(.32)">{globe}{leaf}</g>' + text(138, 92, 'TERRA', 74, '#FFFFFF', BARLOW, '600', 'stroke="#071632" stroke-width="2"')
sky = '<defs>' + vgrad('dawn', (0, '#07142E'), (.45, '#1D5C9E'), (.75, '#7FC7E8'), (1, '#CFEFF2')) + '</defs><rect width="1920" height="1080" fill="url(#dawn)"/>'
far = ('<polygon points="0,640 180,500 330,590 520,380 700,560 880,420 1120,600 1340,360 1560,560 1740,450 1920,600 1920,800 0,800" fill="#4B6A8E"/>'
'<polygon points="520,380 700,560 610,800 450,800" fill="#3A5676"/><polygon points="1340,360 1560,560 1480,800 1270,800" fill="#3A5676"/><polygon points="880,420 1120,600 1020,800 840,800" fill="#3A5676"/>'
'<polygon points="520,380 582,440 548,458 512,430 470,462 452,445" fill="#F2F8FB"/><polygon points="1340,360 1412,425 1372,448 1336,418 1296,455 1262,430" fill="#F2F8FB"/><polygon points="880,420 930,462 900,475 872,455 842,472" fill="#F2F8FB"/>')
water = '<defs>' + vgrad('lake', (0, '#2BB3A8'), (1, '#0E6E7E')) + '</defs><rect y="700" width="1920" height="200" fill="url(#lake)"/>'
rng = random.Random(17)
def ridge(y, colour, step, height, seed):
r = random.Random(seed)
pts, x = [f'0,1080', f'0,{y}'], 0
while x < 1920:
pts.append(f'{x},{y - r.randint(0, height)}')
x += r.randint(step // 2, step)
return f'<polygon points="{" ".join(pts)} 1920,{y} 1920,1080" fill="{colour}"/>'
mid = ridge(800, '#1C6B46', 110, 90, 3)
forest = ridge(910, '#0F4D33', 80, 70, 5)
trees = ''
x = -10
while x < 1940:
h = rng.randint(70, 150)
trees += f'<polygon points="{x},{1090 - rng.randint(0, 60)} {x + 34},{950 - h + 60} {x + 68},{1090}" fill="{rng.choice(["#0A3524", "#0C3E2A", "#082C1E"])}"/>'
x += rng.randint(30, 58)
earth = ('<defs>' + rgrad('earthglow', (.1, '#4FB7E0'), (.8, '#123E7E'), (1, '#07142E')) + '</defs><g transform="translate(1570,215) scale(.56) translate(-960,-300)"><circle cx="960" cy="300" r="230" fill="url(#earthglow)"/>'
'<path d="M850 190C930 150 1010 180 1020 230C1026 280 950 270 930 310C912 350 950 410 900 430C840 380 810 280 850 190Z" fill="#3E9B5C"/><path d="M1060 300C1110 280 1170 320 1162 380C1134 430 1076 470 1044 462C1052 410 1024 350 1060 300Z" fill="#3E9B5C"/><circle cx="960" cy="300" r="230" fill="none" stroke="#BDEBFF" stroke-width="6" opacity=".8"/></g>')
layers = [('sky', sky + stars(12, 40, '#FFFFFF', 300)), ('earth', earth), ('peaks', far), ('water', water), ('ridge', mid), ('forest', forest + trees)]
return dict(id='orbit-terra', name='Terra', tag='Natural history and wildlife', palette=[('Ocean blue', '#07142E'), ('Forest green', '#1C6B46'), ('Turquoise', '#2BB3A8'), ('Leaf', '#9BE564'), ('Highlight', '#EAF8FF')],
accent='#9BE564', parts=parts, epg=epg, bug=bug, layers=layers, background='#07142E', base=['sky', 'peaks', 'water', 'ridge', 'forest'],
motion=[('earth', .5)], rise={'peaks': 60, 'water': 110, 'ridge': 170, 'forest': 260}, trail=([[120, 620], [1760, 300]], [[0, 0], [-500, 120]], [[520, 120], [0, 0]]),
reveal=[('globe', 2.3, 'fade'), ('orbit', 2.42, 'fade'), ('word', 2.42, 'rise'), ('sweep', 2.55, 'fade'), ('accent', 2.75, 'pop')], note='The landscape rises past the camera in layers, revealing Earth, a green orbital line draws, then the logo appears and the leaf settles on the globe.')
def dark_files():
steel = vgrad('steel', (0, '#FFFFFF'), (.55, '#D7DEE9'), (1, '#8FA0B8'))
red = vgrad('evred', (0, '#E3263F'), (1, '#A7132A'))
defs = '<defs>' + SILVER + steel + red + '</defs>'
mark = defs + crescent() + ring('#C8102E')
orbit = text(510, 100, 'ORBIT', 50, '#D7DEE9', BARLOW, '600', 'letter-spacing="24"')
dark = text(486, 326, 'DARK', 214, 'url(#steel)', ANTON, '400', 'letter-spacing="26"')
files = text(486, 552, 'FILES', 214, 'url(#evred)', ANTON, '400', 'letter-spacing="16"')
sweep = '<path d="M300 600C720 620 1040 600 1320 530" fill="none" stroke="#C8102E" stroke-width="7"/>'
parts = [('crescent', mark), ('orbit', defs + orbit), ('word', defs + dark), ('accent', defs + files), ('sweep', sweep)]
small = f'<g transform="translate(-5,1) scale(.26)">{crescent()}{ring("#C8102E")}</g>'
epg = defs + small + text(136, 46, 'ORBIT', 18, '#D7DEE9', BARLOW, '600', 'letter-spacing="8"') + text(134, 116, 'DARK', 62, '#F2F5FA', ANTON, '400', 'letter-spacing="2"') + text(278, 116, 'FILES', 62, '#E3263F', ANTON, '400', 'letter-spacing="2"')
bug = defs + f'<g transform="translate(-7,-8) scale(.22)">{crescent("#FFFFFF")}{ring("#E3263F")}</g>' + text(104, 68, 'DARK', 50, '#FFFFFF', ANTON, '400', 'letter-spacing="3" stroke="#071632" stroke-width="1.5"') + text(104, 122, 'FILES', 50, '#FF3A50', ANTON, '400', 'letter-spacing="3" stroke="#071632" stroke-width="1.5"')
wall = '<defs>' + vgrad('wall', (0, '#050A18'), (.65, '#0D1A33'), (1, '#16233F')) + '</defs><rect width="1920" height="1080" fill="url(#wall)"/>'
pane = '<rect x="140" y="110" width="620" height="440" fill="#0A1730" stroke="#1E2C4A" stroke-width="10"/><line x1="450" y1="110" x2="450" y2="550" stroke="#1E2C4A" stroke-width="10"/><line x1="140" y1="330" x2="760" y2="330" stroke="#1E2C4A" stroke-width="10"/><path d="M640 170C590 165 568 240 620 260C594 234 604 196 640 170Z" fill="#B7CBE8" opacity=".55"/>'
city = f'<g transform="translate(140,280) scale(.323,.25)">{skyline(44, "#050A18", "#FFDE59", 200, 760)}</g>'
desk = '<defs>' + vgrad('desk', (0, '#3A2C22'), (1, '#1C1510')) + '</defs><polygon points="0,700 1920,660 1920,1080 0,1080" fill="url(#desk)"/>'
folder = ('<g transform="rotate(-4 900 860)"><path d="M560 700H780L820 738H1260V1040H560Z" fill="#B99C6B"/><rect x="580" y="750" width="680" height="300" fill="#D8BE8E"/>'
+ text(700, 930, 'CASE FILE', 92, '#C8102E', ANTON, '400', 'letter-spacing="8" opacity=".85"') + '<rect x="680" y="842" width="440" height="106" fill="none" stroke="#C8102E" stroke-width="7" opacity=".85"/></g>')
def photo(x, y, angle, inner):
return f'<g transform="translate({x},{y}) rotate({angle})"><rect width="280" height="210" fill="#EFE9DC"/><rect x="14" y="14" width="252" height="164" fill="#0D1525"/>{inner}</g>'
moon = '<circle cx="190" cy="60" r="20" fill="#B7CBE8"/><polygon points="14,178 80,90 140,140 200,70 266,178" fill="#050A18"/>'
house = '<polygon points="70,178 70,110 130,70 190,110 190,178" fill="#050A18"/><rect x="110" y="120" width="26" height="26" fill="#FFDE59" opacity=".8"/>'
prints = ''.join(f'<ellipse cx="140" cy="100" rx="{12 + i * 11}" ry="{16 + i * 13}" fill="none" stroke="#B7CBE8" stroke-width="3"/>' for i in range(6))
photos = [('photo_1', photo(1180, 640, 7, moon)), ('photo_2', photo(1370, 780, -5, prints)), ('photo_3', photo(300, 700, -9, house))]
glow = '<defs>' + rgrad('lampglow', (0, '#FFE5A6', .8), (.45, '#FFD27A', .34), (1, '#FFD27A', 0)) + '</defs><ellipse cx="1320" cy="760" rx="820" ry="420" fill="url(#lampglow)"/>'
lamp = ('<path d="M1820 1080V560C1820 440 1700 330 1560 290" fill="none" stroke="#1E2433" stroke-width="20"/><path d="M1590 170C1490 190 1380 290 1350 420L1660 340C1650 270 1630 210 1590 170Z" fill="#2A3040"/><path d="M1350 420L1660 340C1640 372 1520 420 1350 420Z" fill="#FFE9B5"/>')
layers = [('wall', wall + pane + city), ('desk', desk), ('lamp', lamp), ('glow', glow), ('folder', folder)] + photos
return dict(id='orbit-dark-files', name='Dark Files', tag='True crime, mystery and paranormal non-fiction', palette=[('Night', '#070B1A'), ('Charcoal', '#1B2232'), ('Steel', '#7F96B4'), ('File beige', '#D8BE8E'), ('Evidence red', '#C8102E'), ('Ghost glow', '#CFE3FF')],
accent='#C8102E', parts=parts, epg=epg, bug=bug, layers=layers, background='#070B1A', base=['wall', 'desk', 'lamp'],
motion=[('glow', .3), ('folder', .75), ('photo_1', 1.2), ('photo_2', 1.4), ('photo_3', 1.6)], slide={'folder': 90, 'photo_1': 60, 'photo_2': 60, 'photo_3': 60}, trail=([[220, 900], [1500, 560]], [[0, 0], [-340, 170]], [[340, 130], [0, 0]]),
reveal=[('crescent', 2.3, 'fade'), ('orbit', 2.42, 'fade'), ('word', 2.42, 'rise'), ('accent', 2.6, 'rise'), ('sweep', 2.72, 'fade')], note='A desk lamp warms up, the case folder and photographs arrive one at a time, a red line draws, then the logo appears.')
def pixelz():
defs = '<defs>' + SILVER + vgrad('pix', (0, '#BDF3FF'), (.5, '#37E5FF'), (1, '#1F7DFF')) + vgrad('zed', (0, '#E6FF4D'), (1, '#6EC800')) + '</defs>'
mark = defs + crescent() + ring('#E03BFF')
orbit = text(520, 160, 'ORBIT', 50, '#E8EDF5', BARLOW, '600', 'letter-spacing="24"')
word = text(470, 420, 'Pixel', 236, '#123C9C', ROUND, '700', 'stroke="#123C9C" stroke-width="30" stroke-linejoin="round"') + text(470, 420, 'Pixel', 236, 'url(#pix)', ROUND, '700', 'stroke="url(#pix)" stroke-width="14" stroke-linejoin="round"')
zed = '<path d="M1140 96H1530C1566 96 1578 136 1554 164L1340 396H1516C1560 396 1560 500 1516 500H1124C1086 500 1072 462 1098 432L1312 202H1140C1096 202 1096 96 1140 96Z" fill="url(#zed)" stroke="#2C7A00" stroke-width="8"/>'
rng = random.Random(6)
bits = ''.join(cube(x, y, s, t, l, r_) for x, y, s, t, l, r_ in [(1010, 44, 26, '#D5FF45', '#7BC400', '#99E000'), (1090, 16, 18, '#62EBFF', '#1F7DFF', '#37B8FF'), (1050, 100, 15, '#EE7BFF', '#9A2BD6', '#C04BF0')])
parts = [('crescent', mark), ('orbit', defs + orbit), ('word', defs + word), ('accent', defs + zed), ('sweep', bits)]
small = f'<g transform="translate(-5,1) scale(.26)">{crescent()}{ring("#E03BFF")}</g>'
epg = defs + small + text(136, 50, 'ORBIT', 18, '#E8EDF5', BARLOW, '600', 'letter-spacing="8"') + text(130, 122, 'Pixel', 70, 'url(#pix)', ROUND, '700', 'stroke="url(#pix)" stroke-width="4"') + f'<g transform="translate(36,7) scale(.27)">{zed}</g>'
bug = defs + f'<g transform="translate(-7,-8) scale(.22)">{crescent("#FFFFFF")}{ring("#E03BFF")}</g>' + text(104, 96, 'Pixel', 76, '#071632', ROUND, '700', 'stroke="#071632" stroke-width="9"') + text(104, 96, 'Pixel', 76, '#62EBFF', ROUND, '700', 'stroke="#62EBFF" stroke-width="3.5"') + f'<g transform="translate(-6,-6) scale(.25)">{zed}</g>'
sky = '<defs>' + vgrad('pixsky', (0, '#0B0E3A'), (.55, '#3E1A9E'), (1, '#8A2BE2')) + '</defs><rect width="1920" height="1080" fill="url(#pixsky)"/>'
floor = ''
tones = [('#62EBFF', '#1F7DFF', '#37B8FF'), ('#D5FF45', '#7BC400', '#99E000'), ('#EE7BFF', '#9A2BD6', '#C04BF0'), ('#5B3AD0', '#26127A', '#3A1FA0')]
cells = []
for row in range(10):
for col in range(-2, 18):
cells.append((row, col))
r = random.Random(14)
for row, col in cells:
s = 78
x = col * s * 1.74 + (row % 2) * s * .87
y = 690 + row * s * .5 + r.randint(-16, 16)
t = r.choices(tones, [2, 1, 2, 6])[0]
floor += cube(x, y, s, *t)
float_cubes = []
for i, (x, y, s, t) in enumerate([(240, 240, 76, 0), (470, 130, 44, 1), (1660, 210, 92, 2), (1420, 110, 42, 0), (1780, 470, 50, 1), (120, 520, 52, 2), (930, 90, 34, 1)]):
float_cubes.append((f'cube_{i + 1}', cube(x, y, s, *tones[t])))
layers = [('sky', sky + stars(61, 60)), ('floor', floor)] + float_cubes
return dict(id='orbit-pixelz', name='PixelZ', tag='CGI family films', palette=[('Electric cyan', '#37E5FF'), ('Lime', '#B7FF2E'), ('Bright purple', '#8B3BFF'), ('Night', '#0B0E3A')],
accent='#B7FF2E', parts=parts, epg=epg, bug=bug, layers=layers, background='#0B0E3A', base=['sky', 'floor'],
motion=[(name, .3 + i * .16) for i, (name, _) in enumerate(float_cubes)], drop={name for name, _ in float_cubes}, trail=([[140, 700], [1500, 470]], [[0, 0], [-360, 170]], [[360, 120], [0, 0]]),
reveal=[('crescent', 2.2, 'fade'), ('orbit', 2.3, 'fade'), ('word', 2.34, 'rise'), ('sweep', 2.5, 'pop'), ('accent', 2.62, 'bounce')], note='Bright cubes drop in one at a time, a magenta line draws, the word forms, then the oversized lime Z bounces into place.')
CHANNELS = {'ring-x': ring_x, 'riot': riot, 'odyssey': odyssey, 'terra': terra, 'dark-files': dark_files, 'pixelz': pixelz}
def vc(src, dst, *options):
subprocess.run(['vectorcraft-cli', 'convert', str(src), str(dst), *options], env=ENV, check=True, stdout=subprocess.DEVNULL)
def review_board(c, primary, epg, bug, background):
clip = '<defs><clipPath id="hero"><rect width="1920" height="1080"/></clipPath></defs>'
background = f'{clip}<g clip-path="url(#hero)">{background}</g>'
board = f'<rect width="1920" height="1440" fill="{NAVY}"/>' + text(70, 75, f'Orbit {c["name"]}', 32, 'white', BARLOW, '600') + text(70, 113, f'Branding proof 01 / {c["tag"]}', 20, MUTED)
board += f'<g transform="translate(60,130) scale(.68)">{primary}</g>'
board += text(1180, 170, 'Hero background', 22, MUTED) + f'<g transform="translate(1180,190) scale(.34)">{background}</g>'
board += f'<path d="M70 590H1850" stroke="{BLUE}"/>' + text(70, 636, 'Compact EPG', 22, MUTED) + f'<rect x="70" y="660" width="720" height="200" fill="{PANEL}"/><g transform="translate(100,680)">{epg}</g>'
board += text(870, 636, 'Playback bug, transparent', 22, MUTED) + f'<g transform="translate(900,700)">{bug}</g>'
board += text(70, 915, 'Playback bug at 1080p size, over the hero background', 22, MUTED)
board += f'<g transform="translate(70,940)"><g transform="scale(.46)">{background}</g><g transform="translate(40,420) scale(.375)" opacity=".85">{bug}</g></g>'
x = 1000
board += text(x, 915, 'Palette', 22, MUTED)
for i, (label, colour) in enumerate(c['palette']):
board += f'<rect x="{x + (i % 3) * 280}" y="{940 + (i // 3) * 130}" width="250" height="70" fill="{colour}" stroke="{BLUE}"/>' + text(x + (i % 3) * 280, 1035 + (i // 3) * 130, f'{label} {colour}', 20, MUTED)
board += text(x, 1250, 'Original artwork, redrawn from the concept board.', 22, 'white') + text(x, 1285, 'Navy interface and yellow remote focus stay. No concept pixels used.', 22, MUTED)
return svg(1920, 1440, board)
def build_static(key):
c = CHANNELS[key]()
d = HERE / c['id']
s, e, r = d / 'sources', d / 'exports', d / 'review'
for folder in (s, e, r):
folder.mkdir(parents=True, exist_ok=True)
primary = ''.join(body for _, body in c['parts'])
stem = c['id'].replace('-', '_')
(s / f'{stem}_primary.svg').write_text(svg(1600, 640, primary))
(s / f'{stem}_epg.svg').write_text(svg(512, 160, c['epg']))
(s / f'{stem}_bug.svg').write_text(svg(384, 128, c['bug']))
for name in ('primary', 'epg', 'bug'):
src = s / f'{stem}_{name}.svg'
vc(src, s / f'{stem}_{name}.vectorcraft')
vc(src, e / f'{stem}_{name}.png')
vc(src, e / f'{stem}_{name}.svg', '--outline-text')
Image.open(e / f'{stem}_epg.png').convert('RGBA').resize((256, 80), Image.LANCZOS).save(e / f'{stem}_epg_app.webp', quality=90)
Image.open(e / f'{stem}_bug.png').convert('RGBA').resize((144, 48), Image.LANCZOS).save(e / f'{stem}_bug_app.webp', quality=90)
for name, body in c['parts']:
part = s / f'logo_{name}.svg'
part.write_text(svg(1600, 640, body))
vc(part, e / f'logo_{name}.png')
background = ''
for name, body in c['layers']:
background += body
layer = s / f'bg_{name}.svg'
layer.write_text(svg(1920, 1080, body))
vc(layer, e / f'bg_{name}.png')
(s / f'{stem}_background.svg').write_text(svg(1920, 1080, background))
first, *rest = [n for n, _ in c['layers']]
cmd = ['photocraft-cli', 'run', str(e / f'bg_{first}.png')]
for name in rest:
cmd += ['--cmd', 'file.placeEmbedded', '--params', json.dumps({'path': str(e / f'bg_{name}.png'), 'fit': False, 'center': [960, 540]})]
pcraft = s / f'{stem}_background.pcraft'
subprocess.run(cmd + ['--out', str(pcraft)], check=True, stdout=subprocess.DEVNULL)
subprocess.run(['photocraft-cli', 'convert', str(pcraft), str(e / f'{stem}_background.webp'), '--quality', '85'], check=True, stdout=subprocess.DEVNULL)
board = s / f'{stem}_review.svg'
board.write_text(review_board(c, primary, c['epg'], c['bug'], background))
subprocess.run(['figcraft-cli', 'convert', str(board), str(r / f'{stem}_review.figcraft')], env=ENV, check=True, stdout=subprocess.DEVNULL)
subprocess.run(['figcraft-cli', 'export', str(r / f'{stem}_review.figcraft'), '--out', str(r / f'{stem}_review.png')], env=ENV, check=True, stdout=subprocess.DEVNULL)
return c, d, stem
def build_ident(c, d, stem):
s, e, r = d / 'sources', d / 'exports', d / 'review'
end = 4.2
steps = [{'command': 'comp.new', 'params': {'name': f'{c["name"]} ident', 'width': 1280, 'height': 720, 'frameRate': 25, 'duration': end, 'background': c['background']}}]
def cmd(command, **params):
steps.append({'command': command, 'params': params})
def key(layer, path, t, v):
cmd('prop.addKey', layer=layer, path=path, time=round(t, 3), value=v)
def load(path, name, scale):
cmd('file.import', paths=[str(path)], addToComp=True)
cmd('layer.rename', layer='#1', name=name)
cmd('prop.set', layer=name, path='transform/scale', value=[scale, scale, 100])
motion = dict(c['motion'])
for name, _ in c['layers']:
layer = f'Background {name}'
load(e / f'bg_{name}.png', layer, 66.6667)
if name in motion:
t = motion[name]
# Every entrance ramps over at least 0.35 s, so nothing flashes.
for at, v in [(0, 0), (t, 0), (t + .4, 100)]:
key(layer, 'transform/opacity', at, v)
if name in c.get('pop', ()):
for at, v in [(t, [40, 40, 100]), (t + .22, [71, 71, 100]), (t + .36, [66.67, 66.67, 100])]:
key(layer, 'transform/scale', at, v)
if name in c.get('slide', {}):
offset = c['slide'][name] * 2 / 3
for at, v in [(t, [640, 360 + offset, 0]), (t + .4, [640, 360, 0])]:
key(layer, 'transform/position', at, v)
if name in c.get('drop', ()):
for at, v in [(t, [640, 240, 0]), (t + .34, [640, 372, 0]), (t + .46, [640, 360, 0])]:
key(layer, 'transform/position', at, v)
if name in c.get('rise', {}):
offset = c['rise'][name] * 2 / 3
for at, v in [(0, [640, 360 + offset, 0]), (1.5, [640, 360, 0])]:
key(layer, 'transform/position', at, v)
vertices, tangents_in, tangents_out = c['trail']
scaled = lambda points: [[round(v * 2 / 3, 1) for v in p] for p in points]
path = {'t': 'Path', 'v': {'vertices': scaled(vertices), 'in_tangents': scaled(tangents_in), 'out_tangents': scaled(tangents_out), 'closed': False}}
rgb = [int(c['accent'][i:i + 2], 16) / 255 for i in (1, 3, 5)]
for name, width, opacity in [('Orbital trail glow', 10, 16), ('Orbital trail', 3, 100)]:
cmd('layer.newShape', kind='none', name=name)
for kind in ('path', 'stroke', 'trim'):
cmd('layer.addShapeItem', layer=name, kind=kind)
for prop, value in [('transform/position', [0, 0, 0]), ('contents/path/path', path), ('contents/stroke/color', rgb + [1]), ('contents/stroke/width', width), ('contents/stroke/opacity', opacity), ('contents/stroke/cap', 1)]:
cmd('prop.set', layer=name, path=prop, value=value)
key(name, 'contents/trim/end', 0, 0)
key(name, 'contents/trim/end', 1.3, 0)
key(name, 'contents/trim/end', 2.3, 100)
# The line hands over to the logo's own sweep, so it never crosses the finished lettering.
for t, v in [(0, 100), (2.3, 100), (2.8, 0)]:
key(name, 'transform/opacity', t, v)
if c.get('scrim', True):
scrim = s / 'logo_scrim.svg'
scrim.write_text(svg(1920, 1080, f'<defs>{rgrad("scrim", (0, c["background"], .82), (.62, c["background"], .62), (1, c["background"], 0))}</defs><ellipse cx="960" cy="500" rx="880" ry="380" fill="url(#scrim)"/>'))
vc(scrim, e / 'logo_scrim.png')
load(e / 'logo_scrim.png', 'Logo scrim', 66.6667)
for t, v in [(0, 0), (2.2, 0), (2.7, 100), (3.95, 100), (end, 0)]:
key('Logo scrim', 'transform/opacity', t, v)
scale, centre = 62, [640, 330, 0]
for name, t, style in c['reveal']:
layer = f'Logo {name}'
load(e / f'logo_{name}.png', layer, scale)
cmd('prop.set', layer=layer, path='transform/position', value=centre)
for at, v in [(0, 0), (t, 0), (t + .3, 100), (3.95, 100), (end, 0)]:
key(layer, 'transform/opacity', at, v)
if style == 'rise':
for at, v in [(t, [640, 348, 0]), (t + .36, centre)]:
key(layer, 'transform/position', at, v)
elif style == 'slam':
for at, v in [(t, [scale * 1.28, scale * 1.28, 100]), (t + .2, [scale * .98, scale * .98, 100]), (t + .32, [scale, scale, 100])]:
key(layer, 'transform/scale', at, v)
elif style == 'pop':
for at, v in [(t, [scale * .8, scale * .8, 100]), (t + .24, [scale * 1.02, scale * 1.02, 100]), (t + .34, [scale, scale, 100])]:
key(layer, 'transform/scale', at, v)
elif style == 'bounce':
for at, v in [(t, [640, 170, 0]), (t + .24, [640, 342, 0]), (t + .36, [640, 306, 0]), (t + .48, centre)]:
key(layer, 'transform/position', at, v)
commands = s / 'build-ident.json'
commands.write_text(json.dumps(steps, indent=1))
project = s / f'{stem}_ident.ecproj'
subprocess.run(['effectcraft-cli', '--empty', 'run', '--commands', str(commands), '--save-as', str(project), '--json'], check=True, stdout=subprocess.DEVNULL)
collected = s / 'ident-project'
if collected.exists():
shutil.rmtree(collected)
subprocess.run(['effectcraft-cli', '--project', str(project), 'exec', 'file.collectFiles', '--params', json.dumps({'folder': str(collected)}), '--json'], check=True, stdout=subprocess.DEVNULL)
subprocess.run(['effectcraft-cli', '--project', str(project), 'render', '--out', str(e / f'{stem}_ident.mp4'), '--format', 'h264', '--fps', '25', '--bitrate', '3500', '--audio', 'off'], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.run(['ffmpeg', '-y', '-v', 'error', '-i', str(e / f'{stem}_ident.mp4'), '-vf', 'select=not(mod(n\\,14)),scale=480:-1,tile=4x2', '-frames:v', '1', str(r / f'{stem}_ident_sheet.png')], check=True)
def flash_check(video):
"""A rough screen for flashing, not a formal photosensitivity test: counts large brightness swings."""
w, h = 64, 36
raw = subprocess.run(['ffmpeg', '-v', 'error', '-i', str(video), '-vf', f'scale={w}:{h},format=gray', '-f', 'rawvideo', '-'], check=True, capture_output=True).stdout
frames = [raw[i:i + w * h] for i in range(0, len(raw), w * h)]
means = [sum(f) / len(f) / 255 for f in frames]
deltas = [b - a for a, b in zip(means, means[1:])]
swings = [d for d in deltas if abs(d) >= .1]
reversals = sum(1 for a, b in zip(swings, swings[1:]) if a * b < 0)
return dict(frames=len(frames), largestFrameChange=round(max(abs(d) for d in deltas), 4), framesChangingOver10Percent=len(swings), brightnessReversals=reversals)
def document(c, d, stem, static):
s, e = d / 'sources', d / 'exports'
report = dict(status='design-proof-not-integrated')
for name in ('primary', 'epg', 'bug'):
alpha = Image.open(e / f'{stem}_{name}.png').convert('RGBA').getchannel('A').getextrema()
info = json.loads(subprocess.check_output(['vectorcraft-cli', 'info', str(s / f'{stem}_{name}.vectorcraft')], env=ENV, text=True))
missing = [f for f in info.get('fonts', []) if f.get('missing')]
assert alpha == (0, 255) and not missing, (name, alpha, missing)
report[name] = dict(alpha=list(alpha), fonts=[f.get('family') or f.get('name') for f in info.get('fonts', [])])
layers = json.loads(subprocess.check_output(['photocraft-cli', 'info', str(s / f'{stem}_background.pcraft')], text=True))['layers']
assert len(layers) == len(c['layers'])
report['photoCraftLayers'] = len(layers)
report['fileSizes'] = {p.name: p.stat().st_size for p in [e / f'{stem}_epg_app.webp', e / f'{stem}_bug_app.webp', e / f'{stem}_background.webp']}
if not static:
video = e / f'{stem}_ident.mp4'
report['ident'] = flash_check(video)
report['fileSizes'][video.name] = video.stat().st_size
collected = s / 'ident-project' / f'{stem}_ident.ecproj'
subprocess.run(['effectcraft-cli', '--project', str(collected), 'render-frame', '--time', '3.4', '--out', str(d / 'review' / f'{stem}_portable_ident_check.png')], check=True, stdout=subprocess.DEVNULL)
report['collectedProjectRendered'] = True
(d / 'verification.json').write_text(json.dumps(report, indent=2))
manifest = dict(status='design-proof-not-integrated', presetId=c['id'], displayName=f'Orbit {c["name"]}', channelNumber=None,
networkTokens=dict(background=NAVY, panel=PANEL, navigation=BLUE, focus=FOCUS, muted=MUTED, text='#FFFFFF'),
palette=dict((label, colour) for label, colour in c['palette']),
assets=dict(primary=f'exports/{stem}_primary.svg', epg=f'exports/{stem}_epg_app.webp', bug=f'exports/{stem}_bug_app.webp', background=f'exports/{stem}_background.webp', ident=f'exports/{stem}_ident.mp4'),
proposedOverlay=dict(default='off', anchor='bottom-left', widthAt1080p=144, heightAt1080p=48, safeInsetPercent=5, opacity=.8, hideForProgrammeStrip=True, hideForSubtitles=True),
ident=dict(durationSeconds=4.2, fps=25, width=1280, height=720, codec='h264', audio=False, alpha=False, schedulePolicy='optional; never delays scheduled media; a longer ident needs an explicit scheduled slot'))
(d / 'branding-manifest.json').write_text(json.dumps(manifest, indent=2))
(d / 'README.md').write_text(f"""# Orbit {c['name']} — branding proof 01
{c['tag']}. Original artwork, redrawn from Paul's concept board. The board is direction only: no pixels are copied from it, and it's kept in `design/references`.
## Ident
{c['note']} 4.2 seconds, silent H.264, 1280x720, 25 fps. It isn't in the app and can't delay a programme.
## Files
- `review/{stem}_review.png`: logo, EPG, bug, background and palette. Editable as `.figcraft`.
- `review/{stem}_ident_sheet.png`: frames through the ident.
- `exports/`: transparent logos (PNG, outlined SVG), app-sized `_epg_app.webp` (256x80) and `_bug_app.webp` (144x48), background WebP, ident MP4, and the separate layers the ident uses.
- `sources/`: VectorCraft logo files with live text, layered PhotoCraft background, source SVGs, and `ident-project/` holding the self-contained EffectCraft project.
`../build-network-brands.py` rebuilds all of this. Fonts are in `../network-fonts`, with licences in the project's `licenses/` folder.
## Status
A design proof for review, not integrated. Android drawing, the bug's visibility over real programmes, subtitle behaviour and any ident timing still need testing on the box. `verification.json` records the checks; its brightness figures are a rough screen, not a formal photosensitivity test.
""")
def network_sheet():
tiles = []
for key in CHANNELS:
c = CHANNELS[key]()
stem = c['id'].replace('-', '_')
d = HERE / c['id']
frame = d / 'review' / f'{stem}_portable_ident_check.png'
tiles.append(Image.open(frame).convert('RGB').resize((960, 540), Image.LANCZOS))
sheet = Image.new('RGB', (1920 + 20, 540 * 3 + 40), NAVY)
for i, tile in enumerate(tiles):
sheet.paste(tile, ((i % 2) * 980, (i // 2) * 560))
sheet.save(HERE / 'network-review.png')
def main():
args = [a for a in sys.argv[1:] if not a.startswith('--')]
static = '--static' in sys.argv
for key in args or CHANNELS:
c, d, stem = build_static(key)
if not static:
build_ident(c, d, stem)
document(c, d, stem, static)
print('built', c['id'], flush=True)
if not static and not args:
network_sheet()
if __name__ == '__main__':
main()