Alexandre B A Villares 2020-01-17 23:54:33 -02:00
rodzic 76dbe84027
commit 7a51de4805
4 zmienionych plików z 83 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,44 @@
from __future__ import division
def fundo(nome, img):
seed = 0
for c in nome:
seed += ord(c)
print(seed)
randomSeed(seed)
noStroke()
grade(width / 2, height / 2, 8, height, img)
rectMode(CORNER)
fill(255)
noStroke()
def grade(xo, yo, n, tw, img):
paleta = (color(241, 120, 175),
color(0, 164, 207),
color(253, 208, 115),
color(255)
)
cw = tw / n
offset = (cw - tw) / 2.
for i in range(n):
x = xo + offset + cw * i
for j in range(n):
y = yo + offset + cw * j
if cw > 5 and random(10) < 7 or cw > 50:
grade(x, y, 3, cw, img)
else:
c = (i + j) % 3
fill(paleta[c])
# fill(127 + i*32 - j*64)
# t = "i{} j{} t{}".format(i, j, (127 + i*32 - j*64))
rectMode(CENTER)
square(x, y, cw)
c2 = (i - j) % 3
if c2 == c:
c2 = c - 1
if img.get(int(x),
int(y)) != color(255):
fill(paleta[c2])
else:
fill(0)
circle(x, y, cw)

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 596 KiB

Wyświetl plik

@ -0,0 +1,39 @@
from __future__ import unicode_literals
from fundo import fundo
add_library('pdf')
modelo = "poster"
nomes = [
"""PCD
2020
SP""",
]
def setup():
global modelo, frente, f
size(400, 600)
noLoop()
f = createFont('Tomorrow-Medium', 150) # precisa ter Tomorrow M instalada
def draw():
pdf = createGraphics(width, height, PDF, "{}-{}.pdf".format(modelo, "PCD20SP"))
beginRecord(pdf)
for nome in nomes:
img = draw_text(nome, width / 2, height / 2)
image(img, 0, 0)
fundo(nome, img)
if nome != nomes[-1]:
pdf.nextPage()
endRecord()
# exit() # fecha o sketch!
def draw_text(txt, x, y, text_size=250):
img = createGraphics(width, height)
img.beginDraw()
img.textFont(f)
img.textAlign(CENTER, CENTER)
img.textSize(text_size)
img.textFont(f)
img.text(txt, x, y)
img.endDraw()
return img