takethestreet/tools/ejes.py
hacklab 03cf3ea7bd Web de takethestreet.net (site/): una calle, todas las luchas
Portada con el lema, los cuatro ejes (Techo, Tierra, Sin fronteras, Paz)
con su color y su piña de monigotes, franja de feminismos, acampadas por
país, cómo nos organizamos y difunde. HTML y CSS sin JavaScript.
Ideario: feminismos transversales y Palestina dentro de Paz.
2026-10-13 14:02:06 +02:00

44 lines
2.6 KiB
Python

# Genera site/img/eje-*.svg: una piña pequeña de tres monigotes de un trazo en zigzag,
# en el color de cada eje del ideario (los mismos colores que los regueros del dibujo).
import sys, random, math, os
OUT = sys.argv[1]
EJES = {"techo": "#f04e23", "tierra": "#14965a", "fronteras": "#f2b705", "paz": "#3b5bdb", "feminismos": "#8e44c9"}
DEFS = ('<defs><filter id="spray" x="-30%" y="-10%" width="160%" height="120%"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="2" seed="3" result="t"/>'
'<feDisplacementMap in="SourceGraphic" in2="t" scale="1.6" result="d"/><feGaussianBlur in="d" stdDeviation=".4" result="b"/>'
'<feGaussianBlur in="SourceGraphic" stdDeviation="2.5" result="n"/><feComponentTransfer in="n" result="n2"><feFuncA type="linear" slope=".3"/></feComponentTransfer>'
'<feMerge><feMergeNode in="n2"/><feMergeNode in="b"/></feMerge></filter></defs>')
def monigote(o, x, y, h, col, brazo=False, paso=False):
sw = max(1.4, h * .016)
pts, yy, i, top = [], y - h, 0, y - h
while yy <= y:
t = (yy - top) / h
cx = x
if t < .13:
w = h * .055 * math.sin(math.pi * t / .13) ** .6 + sw * .3
elif t < .16:
w = h * .01
else:
u = (t - .16) / .84
w = h * (.07 * (1 - u) ** .8 + .016)
if paso and u > .5:
cx += (-1 if (i // 2) % 2 else 1) * h * .04 * (u - .5) / .5
w *= .6
pts.append((cx + (-1 if i % 2 else 1) * w * random.uniform(.75, 1.25), yy))
yy += sw * 2.1 * random.uniform(.85, 1.15) * (.55 if t < .13 else 1)
i += 1
d = "M" + " L".join(f"{px:.1f},{py:.1f}" for px, py in pts)
o.append(f'<path d="{d}" fill="none" stroke="{col}" stroke-width="{sw:.1f}" stroke-linejoin="round" stroke-linecap="round" filter="url(#spray)"/>')
if brazo:
bx, by = x + h * .06, top + h * .2
p = [(bx + j / 9 * h * .06 + (-1 if j % 2 else 1) * h * .014, by - j / 9 * h * .3) for j in range(10)]
o.append(f'<path d="M' + " L".join(f"{px:.1f},{py:.1f}" for px, py in p) + f'" fill="none" stroke="{col}" stroke-width="{sw:.1f}" stroke-linecap="round" filter="url(#spray)"/>')
os.makedirs(OUT, exist_ok=True)
for n, (nombre, col) in enumerate(EJES.items()):
random.seed(40 + n)
o = []
monigote(o, 38, 150, 112, col, paso=True)
monigote(o, 102, 156, 120, col, paso=True)
monigote(o, 70, 160, 140, col, brazo=True)
open(f"{OUT}/eje-{nombre}.svg", "w").write(f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 170" width="140" height="170">{DEFS}' + "".join(o) + "</svg>\n")