From fafaebb051907a848a9406f9da19669c81a83a3b Mon Sep 17 00:00:00 2001 From: Elvis Claros Castro Date: Sat, 26 Sep 2026 20:50:41 -0300 Subject: Translate code, comments and logs to English; English README; configurable paths and env vars Identifiers, docstrings, comments and console messages are now in English. Narration, subtitles and on-screen text stay in Spanish (they are the video content). The Blender <-> Godot physics protocol uses English keys and body prefixes chosen to keep the original creation order, so cached simulations and renders stay bit-identical. The old Spanish environment variable names are still accepted. --- brand/make_logo.py | 246 ++++++++++++++++++++++++++--------------------------- 1 file changed, 123 insertions(+), 123 deletions(-) (limited to 'brand/make_logo.py') diff --git a/brand/make_logo.py b/brand/make_logo.py index dac08b5..658e921 100644 --- a/brand/make_logo.py +++ b/brand/make_logo.py @@ -1,30 +1,30 @@ # -*- coding: utf-8 -*- -"""Genera el kit de marca de 100cIA. El texto se convierte a curvas con Inkscape, -asi que los SVG no dependen de que la fuente este instalada.""" +"""Generates the 100cIA brand kit. Text is converted to curves with Inkscape, +so the SVGs do not depend on the font being installed.""" import os, re, subprocess, tempfile import xml.etree.ElementTree as ET HERE = os.path.dirname(os.path.abspath(__file__)) BG = "#0B0F1A" -PUNTOS = "#243050" -BLANCO = "#FFFFFF" -AMBAR = "#FFD166" +POINTS = "#243050" +WHITE_C = "#FFFFFF" +AMBER = "#FFD166" TRACK = "#1B2233" -GRIS = "#8D99AE" +C_GRAY = "#8D99AE" -FUENTE = "Roboto Black" +FONT_NAME = "Roboto Black" TRACKING = -0.035 # em -def curvas(partes, size=400, tracking=TRACKING): - """partes = [(texto, color), ...] -> (svg_interno, x, y, w, h) ya en curvas.""" +def curve_list(parts, size=400, tracking=TRACKING): + """parts = [(text, color), ...] -> (inner_svg, x, y, w, h) already as curves.""" tspans = "".join( f'{t}' - for i, (t, c) in enumerate(partes)) + for i, (t, c) in enumerate(parts)) src = (f'{tspans}') with tempfile.TemporaryDirectory() as d: a, b = os.path.join(d, "a.svg"), os.path.join(d, "b.svg") @@ -40,192 +40,192 @@ def curvas(partes, size=400, tracking=TRACKING): NS = "http://www.w3.org/2000/svg" ET.register_namespace("", NS) root = ET.fromstring(raw) - nodo = next(e for e in root.iter() if e.get("id") == "w") - for e in nodo.iter(): + node = next(e for e in root.iter() if e.get("id") == "w") + for e in node.iter(): e.attrib.pop("id", None) e.attrib.pop("aria-label", None) - cuerpo = ET.tostring(nodo, encoding="unicode") - cuerpo = cuerpo.replace(f' xmlns="{NS}"', "") - if not cuerpo.lstrip().startswith("{cuerpo}" - return cuerpo, q["x"], q["y"], q["width"], q["height"] + body_obj = ET.tostring(node, encoding="unicode") + body_obj = body_obj.replace(f' xmlns="{NS}"', "") + if not body_obj.lstrip().startswith("{body_obj}" + return body_obj, q["x"], q["y"], q["width"], q["height"] -def colocar(g, bx, by, bw, bh, cx, cy, ancho): - s = ancho / bw +def place(g, bx, by, bw, bh, cx, cy, width_px): + s = width_px / bw tx = cx - s * (bx + bw / 2) ty = cy - s * (by + bh / 2) return f'{g}' -def puntos(id_, sep=118, r=4.2, color=PUNTOS, op=0.55): +def point_list(id_, sep=118, r=4.2, color=POINTS, op=0.55): return (f'' f'') -def arco(cx, cy, r, desde, hasta, color, w): - """Arco en grados, 0 = arriba, sentido horario.""" +def arc_m(cx, cy, r, since, until, color, w): + """Arc in degrees, 0 = up, clockwise.""" import math def p(a): t = math.radians(a - 90) return cx + r * math.cos(t), cy + r * math.sin(t) - x0, y0 = p(desde) - x1, y1 = p(hasta) - largo = 1 if (hasta - desde) % 360 > 180 else 0 + x0, y0 = p(since) + x1, y1 = p(until) + largo = 1 if (until - since) % 360 > 180 else 0 return (f'') # ---------------------------------------------------------------- avatar -def avatar(archivo, chip=False, pct=0.62): +def avatar(file_path, chip=False, pct=0.62): D = 1024 R = D / 2 - anillo_r, anillo_w = R - 26, 20 + ring_r, ring_w = R - 26, 20 if chip: - g1, x1, y1, w1, h1 = curvas([("100c", BLANCO)]) - g2, x2, y2, w2, h2 = curvas([("IA", "#0B0F1A")]) + g1, x1, y1, w1, h1 = curve_list([("100c", WHITE_C)]) + g2, x2, y2, w2, h2 = curve_list([("IA", "#0B0F1A")]) else: - g1, x1, y1, w1, h1 = curvas([("100c", BLANCO), ("IA", AMBAR)]) + g1, x1, y1, w1, h1 = curve_list([("100c", WHITE_C), ("IA", AMBER)]) - cuerpo = [ + body_obj = [ f'', f'', - f'', - arco(R, R, anillo_r, 0, 360 * pct, AMBAR, anillo_w), + f'', + arc_m(R, R, ring_r, 0, 360 * pct, AMBER, ring_w), ] if chip: - ancho_total = 760 - # el chip de "IA" ocupa ~38% del ancho, como los chips de los videos - w_txt = ancho_total * 0.60 - cuerpo.append(colocar(g1, x1, y1, w1, h1, R - ancho_total / 2 + w_txt / 2, R, w_txt)) - esc = w_txt / w1 - cw, ch = w2 * esc * 1.0 + 70, h1 * esc + 62 - cxc = R - ancho_total / 2 + w_txt + 26 + cw / 2 - cuerpo.append(f'') - cuerpo.append(colocar(g2, x2, y2, w2, h2, cxc, R, w2 * esc)) + total_width = 760 + # the "IA" chip takes ~38% of the width, like the chips in the videos + w_text = total_width * 0.60 + body_obj.append(place(g1, x1, y1, w1, h1, R - total_width / 2 + w_text / 2, R, w_text)) + scale_f = w_text / w1 + cw, ch = w2 * scale_f * 1.0 + 70, h1 * scale_f + 62 + cxc = R - total_width / 2 + w_text + 26 + cw / 2 + body_obj.append(f'') + body_obj.append(place(g2, x2, y2, w2, h2, cxc, R, w2 * scale_f)) else: - cuerpo.append(colocar(g1, x1, y1, w1, h1, R, R, 740)) + body_obj.append(place(g1, x1, y1, w1, h1, R, R, 740)) svg = (f'{puntos("dots")}' - + "".join(cuerpo) + '') - open(os.path.join(HERE, archivo), "w", encoding="utf-8").write(svg) - return archivo - - -# ---------------------------------------------------------------- logotipo -# El chip alrededor del "IA" es la marca: va en todas las variantes menos en la -# "plana", que queda como alternativa. -MODOS = { - # tinta fondo del chip letra del chip - "oscuro": (BLANCO, AMBAR, "#0B0F1A"), + f'viewBox="0 0 {D} {D}">{point_list("dots")}' + + "".join(body_obj) + '') + open(os.path.join(HERE, file_path), "w", encoding="utf-8").write(svg) + return file_path + + +# ---------------------------------------------------------------- wordmark +# The chip around "IA" is the brand: it goes on every variant except the +# "flat" one, kept as an alternative. +MODES = { + # ink chip background chip letter + "oscuro": (WHITE_C, AMBER, "#0B0F1A"), "claro": ("#0B0F1A", "#D98C00", "#FFFFFF"), - "mono": (BLANCO, BLANCO, None), # letras caladas + "mono": (WHITE_C, WHITE_C, None), # knocked-out letters } -def _lockup(modo, alto=520): - """Devuelve (piezas_svg, ancho, alto) del lockup '100c' + chip 'IA'.""" - tinta, fondo_chip, letra = MODOS[modo] - g1, x1, y1, w1, h1 = curvas([("100c", tinta)]) - g2, x2, y2, w2, h2 = curvas([("IA", letra or "#000000")]) +def _lockup(mode, alto=520): + """Returns (svg_pieces, width, height) of the '100c' lockup + 'IA' chip.""" + ink, chip_bg, letter = MODES[mode] + g1, x1, y1, w1, h1 = curve_list([("100c", ink)]) + g2, x2, y2, w2, h2 = curve_list([("IA", letter or "#000000")]) - esc = alto / h1 - wt = w1 * esc - cw = w2 * esc + 0.68 * alto + scale_f = alto / h1 + wt = w1 * scale_f + cw = w2 * scale_f + 0.68 * alto ch = alto + 0.60 * alto - hueco = 0.13 * alto - W = wt + hueco + cw + gap_m = 0.13 * alto + W = wt + gap_m + cw cy = ch / 2 rx = ch * 0.28 - cx_chip = wt + hueco + cw / 2 - chip_x = wt + hueco + cx_chip = wt + gap_m + cw / 2 + chip_x = wt + gap_m - piezas = [colocar(g1, x1, y1, w1, h1, wt / 2, cy, wt)] - if letra is None: # una sola tinta: el IA se cala + pieces = [place(g1, x1, y1, w1, h1, wt / 2, cy, wt)] + if letter is None: # a single ink: the IA is knocked out mascara = (f'' f'' - + colocar(g2, x2, y2, w2, h2, cx_chip, cy, w2 * esc) + + place(g2, x2, y2, w2, h2, cx_chip, cy, w2 * scale_f) + '') - piezas.append(f'{mascara}') - piezas.append(f'') + pieces.append(f'{mascara}') + pieces.append(f'') else: - piezas.append(f'') - piezas.append(colocar(g2, x2, y2, w2, h2, cx_chip, cy, w2 * esc)) - return piezas, W, ch + pieces.append(f'') + pieces.append(place(g2, x2, y2, w2, h2, cx_chip, cy, w2 * scale_f)) + return pieces, W, ch -def wordmark(archivo, modo="oscuro", margen=0.10): - piezas, W0, H0 = _lockup(modo) - m = margen * H0 +def wordmark(file_path, mode="oscuro", margin=0.10): + pieces, W0, H0 = _lockup(mode) + m = margin * H0 W, H = int(round(W0 + 2 * m)), int(round(H0 + 2 * m)) svg = (f'' - + "".join(piezas) + '') - open(os.path.join(HERE, archivo), "w", encoding="utf-8").write(svg) - return archivo + + "".join(pieces) + '') + open(os.path.join(HERE, file_path), "w", encoding="utf-8").write(svg) + return file_path -def wordmark_plano(archivo): - """Alternativa sin chip: '100cIA' de corrido, el IA en ambar.""" - g, x, y, w, h = curvas([("100c", BLANCO), ("IA", AMBAR)]) +def wordmark_plano(file_path): + """Chip-less alternative: '100cIA' in one run, the IA in amber.""" + g, x, y, w, h = curve_list([("100c", WHITE_C), ("IA", AMBER)]) W = 2400 - ancho = W * 0.88 - H = int(round(h / w * ancho + 2 * 0.06 * W)) + width_px = W * 0.88 + H = int(round(h / w * width_px + 2 * 0.06 * W)) svg = (f'' - + colocar(g, x, y, w, h, W / 2, H / 2, ancho) + '') - open(os.path.join(HERE, archivo), "w", encoding="utf-8").write(svg) - return archivo + + place(g, x, y, w, h, W / 2, H / 2, width_px) + '') + open(os.path.join(HERE, file_path), "w", encoding="utf-8").write(svg) + return file_path # ---------------------------------------------------------------- banner -def banner(archivo, tagline="ciencia en 40 segundos"): +def banner(file_path, tagline="ciencia en 40 segundos"): W, H = 1920, 1080 - g, x, y, w, h = curvas([("100c", BLANCO)]) - t, tx, ty, tw, th = curvas([(tagline, "#C9D3E5")], size=200, tracking=0.012) - cuerpo = [ + g, x, y, w, h = curve_list([("100c", WHITE_C)]) + t, tx, ty, tw, th = curve_list([(tagline, "#C9D3E5")], size=200, tracking=0.012) + body_obj = [ f'', f'', f'', - f'', - None, # el lockup se arma abajo (con chip, igual que el avatar) - colocar(t, tx, ty, tw, th, W / 2, H / 2 + 205, 830), + f'', + None, # the lockup is built below (with the chip, like the avatar) + place(t, tx, ty, tw, th, W / 2, H / 2 + 205, 830), ] - # lockup con chip, centrado, a 1150 px de ancho total - g2, x2, y2, w2, h2 = curvas([("IA", "#0B0F1A")]) - ANCHO, cy = 1150, H / 2 - 95 + # lockup with chip, centred, 1150 px total width + g2, x2, y2, w2, h2 = curve_list([("IA", "#0B0F1A")]) + WIDTH, cy = 1150, H / 2 - 95 alto = 210 - esc = alto / h - wt = w * esc - cw, ch = w2 * esc + 0.68 * alto, alto + 0.60 * alto - hueco = 0.13 * alto - total = wt + hueco + cw - k = ANCHO / total - wt, cw, ch, hueco = wt * k, cw * k, ch * k, hueco * k - izq = W / 2 - ANCHO / 2 - cuerpo[cuerpo.index(None)] = ( - colocar(g, x, y, w, h, izq + wt / 2, cy, wt) - + f'' - + colocar(g2, x2, y2, w2, h2, izq + wt + hueco + cw / 2, cy, w2 * esc * k)) + scale_f = alto / h + wt = w * scale_f + cw, ch = w2 * scale_f + 0.68 * alto, alto + 0.60 * alto + gap_m = 0.13 * alto + total = wt + gap_m + cw + k = WIDTH / total + wt, cw, ch, gap_m = wt * k, cw * k, ch * k, gap_m * k + left_part = W / 2 - WIDTH / 2 + body_obj[body_obj.index(None)] = ( + place(g, x, y, w, h, left_part + wt / 2, cy, wt) + + f'' + + place(g2, x2, y2, w2, h2, left_part + wt + gap_m + cw / 2, cy, w2 * scale_f * k)) svg = (f'{puntos("dots", sep=140, r=5)}' - + "".join(cuerpo) + '') - open(os.path.join(HERE, archivo), "w", encoding="utf-8").write(svg) - return archivo + f'viewBox="0 0 {W} {H}">{point_list("dots", sep=140, r=5)}' + + "".join(body_obj) + '') + open(os.path.join(HERE, file_path), "w", encoding="utf-8").write(svg) + return file_path if __name__ == "__main__": - # la variante con chip es la marca: se queda con los nombres principales + # the chip variant is the brand: it keeps the main file names for f in (avatar("avatar.svg", chip=True), avatar("avatar-plano.svg"), wordmark("wordmark.svg", "oscuro"), wordmark("wordmark-claro.svg", "claro"), -- cgit v1.2.3