Alexandre B A Villares 2018-10-04 18:39:26 -03:00
rodzic 3e55f0d6b3
commit f3471125bc
3 zmienionych plików z 97 dodań i 0 usunięć

Wyświetl plik

@ -8,6 +8,11 @@ If you enjoy this, be a [patreon](https://patreon.com/arteprog) or make a donati
---
![s279](s279/s279.gif)
279: [code](https://github.com/villares/sketch-a-day/tree/master/s279) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
---
![s278](s278/s278.png)
278: [code](https://github.com/villares/sketch-a-day/tree/master/s278) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]

BIN
s279/s279.gif 100644

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.7 MiB

92
s279/s279.pyde 100644
Wyświetl plik

@ -0,0 +1,92 @@
# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day
SKETCH_NAME = "s279" # 20181004
OUTPUT = ".gif"
add_library('peasycam')
from random import seed
from random import choice
from random import randint
ascii = """ .`:,';-_*"~!i|/\rI^)+(l?{><=}tc[]sjvJL7f1xzTyYF5e23onuaV4$SkC#EPhZX96U0pqKdbGA%gH8wRBmODN&Q@WM"""
#ascii = """ .`:'-_*"~|/\^)+{><=}[]#"""
rnd_seed = 1000
def setup():
size(600, 600, P3D)
#smooth()
rectMode(CENTER)
colorMode(HSB)
fill(0)
cam = PeasyCam(this, 400)
f = createFont("SourceCodePro-Bold", 14)
textFont(f)
textSize(14)
global mi, ma
mi, ma = 5, 10
def draw():
#noLoop()
background(200)
random_seed()
translate(0, 0, -100)
ensamble(0, 0, 5)
translate(0, 0, 200)
ensamble(0, 0, 5)
translate(0, 0, -100)
rotateX(HALF_PI)
translate(0, 0, -100)
ensamble(0, 0, 5)
translate(0, 0, 200)
ensamble(0, 0, 5)
translate(0, 0, -100)
# ensamble(width/2, height/2, 5)
def ensamble(ex, ey, order):
with pushMatrix():
translate(ex, ey)
# #rotate(QUARTER_PI)
gliph = lambda x, y, l: text(l, x, y)
for _ in range(order):
# rotate(QUARTER_PI)
c = choice(ascii)
order = randint(mi, ma)
spacing, side = 14, 14
x, y = int(random(-5, 5)) * side, int(random(-5, 5)) * side
#fill(randint(1 , 5) * 48, 255, 255) # H, S, B
grid(x, y, order, spacing, gliph, c)
def grid(x, y, order, spacing, function, *args):
with pushMatrix():
translate(x - order * spacing / 2, y- order * spacing / 2)
for i in range(order):
gx = spacing/2 + i * spacing
for j in range(order):
gy = spacing/2 + j * spacing
function(gx, gy, *args)
def keyPressed():
if key == " ": random_seed(renew=True)
if key == "s": saveFrame("###.png")
def random_seed(renew=False):
global rnd_seed
if renew:
rnd_seed = randint(0, 1000)
else:
#from random import seed
seed(rnd_seed)
randomSeed(rnd_seed)
# print text to add to the project's README.md
def settings():
println(
"""
![{0}]({0}/{0}{2})
{1}: [code](https://github.com/villares/sketch-a-day/tree/master/{0}) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
""".format(SKETCH_NAME, SKETCH_NAME[1:], OUTPUT)
)