Faro: la torre en espiral negra y roja

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hacklab 2026-10-14 21:43:01 +02:00
parent 3509b6dd38
commit 2dc0ff5e58
23 changed files with 74 additions and 74 deletions

View file

@ -1,7 +1,7 @@
# Genera el símbolo: un faro dentro de un aro grueso, como un emblema de tienda de graffiti.
# La luz es amarilla: un haz horizontal que se abre hacia los dos lados y un halo en círculo.
import sys
INK, BL, NAR = "#111", "#fff", "#f04e23"
INK, BL, NAR, ROJO = "#111", "#fff", "#f04e23", "#e3141b"
LUZ, CLARA = "#ffc21a", "#fff4b8"
CX, CY = 50, 36 # centro de la linterna
@ -13,26 +13,26 @@ def luz_(luz, clara):
halo = f'<circle cx="{CX}" cy="{CY}" r="12" fill="{luz}"/><circle cx="{CX}" cy="{CY}" r="6.5" fill="{clara}"/>'
return haz + ondas + halo
def torre(ink, papel):
# Torre que se estrecha hacia arriba, con dos franjas, la linterna y el tejado en punta.
cuerpo = f'<path d="M42,46 H58 L65,100 H35 Z" fill="{ink}"/>'
franjas = "".join(f'<path d="M{43.3 - (y - 46) * 7 / 54:.1f},{y} H{56.7 + (y - 46) * 7 / 54:.1f} L{57.3 + (y + 6 - 46) * 7 / 54:.1f},{y + 6} H{42.7 - (y + 6 - 46) * 7 / 54:.1f} Z" fill="{papel}"/>'
for y in (56, 72))
def torre(ink, raya, clip):
# Torre que se estrecha hacia arriba, en espiral negra y roja (franjas en diagonal), la linterna y el tejado en punta.
forma = "M42,46 H58 L65,100 H35 Z"
cuerpo = f'<clipPath id="{clip}t"><path d="{forma}"/></clipPath><path d="{forma}" fill="{ink}"/>'
franjas = "".join(f'<path d="M30,{y + 9} L70,{y - 3} V{y + 6} L30,{y + 18} Z" fill="{raya}"/>' for y in (50, 68, 86))
balcon = f'<rect x="39" y="43" width="22" height="4" rx="1" fill="{ink}"/>'
linterna = f'<path d="M44,43 V31 M56,43 V31" stroke="{ink}" stroke-width="2.6"/>'
tejado = f'<path d="M41,31 L50,21 L59,31 Z" fill="{ink}"/>'
return cuerpo + franjas + balcon + linterna + tejado
tejado = f'<path d="M41,31 L50,21 L59,31 Z" fill="{ink if raya == BL else raya}"/>'
return cuerpo + f'<g clip-path="url(#{clip}t)">{franjas}</g>' + balcon + linterna + tejado
def faro(estilo="aro", ink=INK, luz=LUZ, papel=BL, clara=CLARA, clip="c", grueso=7, fondo_aro=None):
def faro(estilo="aro", ink=INK, luz=LUZ, raya=ROJO, clara=CLARA, clip="c", grueso=7, fondo_aro=None):
if estilo == "aro":
defs = f'<clipPath id="{clip}"><circle cx="50" cy="50" r="42"/></clipPath>'
fondo = f'<circle cx="50" cy="50" r="47" fill="{fondo_aro}"/>' if fondo_aro else ""
dentro = f'<g clip-path="url(#{clip})">{luz_(luz, clara)}{torre(ink, papel)}</g>'
dentro = f'<g clip-path="url(#{clip})">{luz_(luz, clara)}{torre(ink, raya, clip)}</g>'
aro = f'<circle cx="50" cy="50" r="45" fill="none" stroke="{ink}" stroke-width="{grueso}"/>'
return defs + fondo + dentro + aro
# Pegatina: círculo amarillo, la luz en blanco
defs = f'<clipPath id="{clip}"><circle cx="50" cy="50" r="48"/></clipPath>'
return defs + f'<circle cx="50" cy="50" r="48" fill="{luz}"/><g clip-path="url(#{clip})">{luz_(papel, BL)}{torre(ink, luz)}</g>'
return defs + f'<circle cx="50" cy="50" r="48" fill="{luz}"/><g clip-path="url(#{clip})">{luz_(BL, BL)}{torre(ink, raya, clip)}</g>'
def svg(cuerpo, fondo=None):
bg = f'<rect width="100" height="100" fill="{fondo}"/>' if fondo else ""
@ -45,6 +45,6 @@ def simbolo_mapa():
if __name__ == "__main__":
d = sys.argv[1]
open(f"{d}/simbolo.svg", "w").write(svg(faro()))
open(f"{d}/simbolo-negativo.svg", "w").write(svg(faro(ink=BL, papel=INK), INK))
open(f"{d}/simbolo-naranja.svg", "w").write(svg(faro(luz=BL, papel=NAR, clara="#ffe2a8"), NAR))
open(f"{d}/simbolo-negativo.svg", "w").write(svg(faro(ink=BL), INK))
open(f"{d}/simbolo-naranja.svg", "w").write(svg(faro(luz=BL, raya=BL, ink=INK, clara="#ffe2a8"), NAR))
open(f"{d}/simbolo-pegatina.svg", "w").write(svg(faro("pegatina")))