Símbolo: farola de throw-up en naranja
This commit is contained in:
parent
deef1dc77c
commit
7cc81561d3
10 changed files with 34 additions and 43 deletions
|
|
@ -1,41 +1,32 @@
|
|||
import math, sys
|
||||
NAR, AMA = "#f04e23", "#f2b705"
|
||||
import sys
|
||||
NAR, AMA, INK = "#f04e23", "#f2b705", "#111"
|
||||
|
||||
def bordes(signo, t0, t1, n=24):
|
||||
izq, der = [], []
|
||||
for k in range(n + 1):
|
||||
t = t0 + (t1 - t0) * k / n
|
||||
y = 18 + 79 * t
|
||||
a = 5 + 9 * t
|
||||
cx = 72 + signo * a * math.cos(2 * math.pi * t)
|
||||
w = 3 + 6 * t
|
||||
izq.append((cx - w, y)); der.append((cx + w, y))
|
||||
return izq, der
|
||||
def estrella(cx, cy, r, col, borde=None, bw=0):
|
||||
k = r * .22
|
||||
d = (f"M{cx},{cy - r} Q{cx + k},{cy - k} {cx + r},{cy} Q{cx + k},{cy + k} {cx},{cy + r} "
|
||||
f"Q{cx - k},{cy + k} {cx - r},{cy} Q{cx - k},{cy - k} {cx},{cy - r} Z")
|
||||
b = f' stroke="{borde}" stroke-width="{bw}" stroke-linejoin="round"' if borde else ""
|
||||
return f'<path d="{d}" fill="{col}"{b}/>'
|
||||
|
||||
def linea(pts):
|
||||
return "M" + " L".join(f"{x:.1f},{y:.1f}" for x, y in pts)
|
||||
|
||||
def cinta(signo, t0, t1):
|
||||
izq, der = bordes(signo, t0, t1)
|
||||
return linea(izq + der[::-1]) + " Z"
|
||||
|
||||
def farola(ink="#111", fondo=None, nar=NAR, ama=AMA):
|
||||
def farola(ink=INK, rell=NAR, fondo=None, brillo="#fff"):
|
||||
bg = f'<rect width="100" height="100" fill="{fondo}"/>' if fondo else ""
|
||||
corte = fondo or "#fff"
|
||||
def pieza(col, signo, t0, t1, arriba):
|
||||
out = f'<path d="{cinta(signo, t0, t1)}" fill="{col}"/>'
|
||||
if arriba:
|
||||
izq, der = bordes(signo, t0, t1)
|
||||
out += "".join(f'<path d="{linea(e)}" fill="none" stroke="{corte}" stroke-width="1.6" stroke-linecap="round"/>' for e in (izq, der))
|
||||
return out
|
||||
luz = (pieza(ama, 1, 0, .5, False) + pieza(nar, -1, 0, .5, True)
|
||||
+ pieza(nar, -1, .5, 1, False) + pieza(ama, 1, .5, 1, True))
|
||||
poste = f'<path d="M24,100 V30 Q24,12 42,12 H58" fill="none" stroke="{ink}" stroke-width="7"/>'
|
||||
cabeza = f'<path d="M54,7 H90 Q92,7 91,10 L88,16 H57 L53,10 Q52,7 54,7 Z" fill="{ink}"/>'
|
||||
return f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">{bg}{luz}{poste}{cabeza}</svg>\n'
|
||||
eje = "M27,99 V38 Q27,15 50,15 H62"
|
||||
cabeza = "M56,9 Q60,4 74,4 Q90,4 94,12 Q96,18 88,20 H62 Q54,20 54,15 Q54,11 56,9 Z"
|
||||
luz = f'<path d="M63,22 H88 L98,90 H50 Z" fill="{AMA}" opacity=".28"/><path d="M68,22 H83 L88,90 H58 Z" fill="{rell}" opacity=".35"/>'
|
||||
gotas = "".join(f'<path d="M{x - w},{y0} L{x + w},{y0} L{x + w * .7},{y1} Q{x},{y1 + w * 1.7} {x - w * .7},{y1} Z" fill="{ink}"/>'
|
||||
for x, w, y0, y1 in ((23.5, 2.2, 60, 72), (65, 1.8, 20, 28), (90, 1.5, 19, 25)))
|
||||
return (f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100">{bg}{luz}'
|
||||
f'<path d="{eje}" fill="none" stroke="{ink}" stroke-width="17" stroke-linecap="round"/>'
|
||||
f'<path d="{cabeza}" fill="{ink}" stroke="{ink}" stroke-width="7" stroke-linejoin="round"/>'
|
||||
f'{gotas}'
|
||||
f'<path d="{eje}" fill="none" stroke="{rell}" stroke-width="8" stroke-linecap="round"/>'
|
||||
f'<path d="{cabeza}" fill="{rell}"/>'
|
||||
f'<path d="M24.5,80 V52 M24.5,46 V43" stroke="{brillo}" stroke-width="2.4" stroke-linecap="round"/>'
|
||||
f'<path d="M62,10 Q66,7 74,7" fill="none" stroke="{brillo}" stroke-width="2.4" stroke-linecap="round"/>'
|
||||
f'{estrella(76, 52, 13, AMA, ink, 2.5)}{estrella(62, 74, 7, brillo, ink, 2)}</svg>\n')
|
||||
|
||||
if __name__ == "__main__":
|
||||
d = sys.argv[1]
|
||||
open(f"{d}/simbolo.svg", "w").write(farola())
|
||||
open(f"{d}/simbolo-negativo.svg", "w").write(farola("#fff", "#111"))
|
||||
open(f"{d}/simbolo-naranja.svg", "w").write(farola("#111", NAR, nar="#fff"))
|
||||
open(f"{d}/simbolo-negativo.svg", "w").write(farola(fondo=INK, ink="#fff"))
|
||||
open(f"{d}/simbolo-naranja.svg", "w").write(farola(fondo=NAR, rell="#fff", brillo=NAR))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue