From 33ee00e8841aef4f88418fbe2393310554630ee7 Mon Sep 17 00:00:00 2001 From: Alexandre B A Villares <3694604+villares@users.noreply.github.com> Date: Mon, 7 Sep 2020 18:38:45 -0300 Subject: [PATCH] 5 extras --- .../sketch_2020_09_05b.pyde | 57 +++++++++++++++++ .../sketch_2020_09_05c.pyde | 59 ++++++++++++++++++ .../sketch_2020_09_05d.pyde | 62 +++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 2020/sketch_2020_09_05b/sketch_2020_09_05b.pyde create mode 100644 2020/sketch_2020_09_05c/sketch_2020_09_05c.pyde create mode 100644 2020/sketch_2020_09_05d/sketch_2020_09_05d.pyde diff --git a/2020/sketch_2020_09_05b/sketch_2020_09_05b.pyde b/2020/sketch_2020_09_05b/sketch_2020_09_05b.pyde new file mode 100644 index 00000000..9eee0dd6 --- /dev/null +++ b/2020/sketch_2020_09_05b/sketch_2020_09_05b.pyde @@ -0,0 +1,57 @@ +import random + +sf = 1 +colunas = 4 +seed_value = 100 + +gliphs = (lambda x, y, s: square(x, y, s), + lambda x, y, s: circle(x, y, s), + lambda x, y, s: triangle(x - s, y, x - s, y + s, x, y + s), + lambda x, y, s: triangle(x + s, y, x + s, y - s, x, y - s), + ) + +def ensamble(ex, ey, eo): + # print(f"seed inside ensamble: {seed_value}") + # random.seed(seed_value + int(ex * (ey + 100))) # kind of works + noStroke() + for i in range(eo): + if i % 2: + fill(200, 0, 0, 230) + else: + fill(0) + order, spacing, side = random.randint(6, 12), 14, 7 + x = (1 + random.randint(-5, 4)) * side * sf + y = (1 + random.randint(-5, 4)) * side * sf + grid(ex+x, + ey+y, + order, + spacing * sf, + random.choice(gliphs), + side * sf) + +def grid(x, y, order, spacing, function, *args): + if type(order) is tuple: + cols, rows = order + else: + cols = rows = order + xo, yo = (x - cols * spacing / 2 , y - rows * spacing / 2) + for i in range(cols): + gx = spacing / 2 + i * spacing + for j in range(rows): + gy = spacing/2 + j * spacing + function(xo + gx, yo + gy, *args) + + +def setup(): + size(700, 700) + noLoop() + +def draw(): + background(245, 245, 240) + random.seed(seed_value) # doesn't work! I wish it would work here! + grid(width / 2, height / 2, (2, 2), 300 * sf, ensamble, 5) + +def keyPressed(): + global seed_value + seed_value = random.randint(1, 100000000000000) + redraw() diff --git a/2020/sketch_2020_09_05c/sketch_2020_09_05c.pyde b/2020/sketch_2020_09_05c/sketch_2020_09_05c.pyde new file mode 100644 index 00000000..8ad80445 --- /dev/null +++ b/2020/sketch_2020_09_05c/sketch_2020_09_05c.pyde @@ -0,0 +1,59 @@ +import random + +sf = 1 +colunas = 4 +seed_value = 100 + +gliphs = (lambda x, y, s: square(x, y, s), + lambda x, y, s: circle(x, y, s), + lambda x, y, s: triangle(x - s, y, x - s, y + s, x, y + s), + lambda x, y, s: triangle(x + s, y, x + s, y - s, x, y - s), + ) + +colors = (color(200, 0, 0, 230), + color(200, 0, 200, 230), + color(0) + ) + +def ensamble(ex, ey, eo): + # print(f"seed inside ensamble: {seed_value}") + # random.seed(seed_value + int(ex * (ey + 100))) # kind of works + noStroke() + for i in range(eo): + fill(colors[i % len(colors) - 1]) + order, spacing, side = random.randint(6, 12), 14, 7 + x = (1 + random.randint(-5, 4)) * side * sf + y = (1 + random.randint(-5, 4)) * side * sf + grid(ex+x, + ey+y, + order, + spacing * sf, + random.choice(gliphs), + side * sf) + +def grid(x, y, order, spacing, function, *args): + if type(order) is tuple: + cols, rows = order + else: + cols = rows = order + xo, yo = (x - cols * spacing / 2 , y - rows * spacing / 2) + for i in range(cols): + gx = spacing / 2 + i * spacing + for j in range(rows): + gy = spacing/2 + j * spacing + function(xo + gx, yo + gy, *args) + + +def setup(): + size(700, 700) + noLoop() + +def draw(): + background(245, 245, 240) + random.seed(seed_value) # doesn't work! I wish it would work here! + grid(width / 2, height / 2, (2, 2), 300 * sf, ensamble, 5) + +def keyPressed(): + global seed_value + seed_value = random.randint(1, 100000000000000) + redraw() diff --git a/2020/sketch_2020_09_05d/sketch_2020_09_05d.pyde b/2020/sketch_2020_09_05d/sketch_2020_09_05d.pyde new file mode 100644 index 00000000..2f9f10c7 --- /dev/null +++ b/2020/sketch_2020_09_05d/sketch_2020_09_05d.pyde @@ -0,0 +1,62 @@ +import random + +sf = 1 +colunas = 4 +seed_value = 100 + +gliphs = (lambda x, y, s: square(x, y, s), + lambda x, y, s: circle(x, y, s), + lambda x, y, s: triangle(x - s, y, x - s, y + s, x, y + s), + lambda x, y, s: triangle(x + s, y, x + s, y - s, x, y - s), + ) + +colors = ( + color(0, 0, 200, 230), + color(200, 200, 200, 230), + color(0) + ) + +def setup(): + size(1300, 580) + noLoop() + +def draw(): + background(245, 245, 240) + random.seed(seed_value) # doesn't work! I wish it would work here! + grid(width / 2, height / 2, (5, 2), 240 * sf, ensamble, 5) + + +def ensamble(ex, ey, eo): + # print(f"seed inside ensamble: {seed_value}") + # random.seed(seed_value + int(ex * (ey + 100))) # kind of works + noStroke() + for i in range(eo): + fill(colors[i % len(colors) - 1]) + order, spacing, side = random.randint(6, 12), 14, 7 + x = (1 + random.randint(-5, 4)) * side * sf + y = (1 + random.randint(-5, 4)) * side * sf + grid(ex+x, + ey+y, + order, + spacing * sf, + random.choice(gliphs), + side * sf) + +def grid(x, y, order, spacing, function, *args): + if type(order) is tuple: + cols, rows = order + else: + cols = rows = order + xo, yo = (x - cols * spacing / 2 , y - rows * spacing / 2) + for i in range(cols): + gx = spacing / 2 + i * spacing + for j in range(rows): + gy = spacing/2 + j * spacing + function(xo + gx, yo + gy, *args) + + + +def keyPressed(): + global seed_value + seed_value = random.randint(1, 100000000000000) + redraw()