From d51de0c40e081c6984eb75d5cf21b4836ed8d1e5 Mon Sep 17 00:00:00 2001 From: Alexandre B A Villares <3694604+villares@users.noreply.github.com> Date: Sun, 28 Mar 2021 17:07:03 -0300 Subject: [PATCH] 28 many grids with while loop --- .../sketch_2021_03_28a.pyde | 12 +++++++++ .../sketch_2021_03_28b.pyde | 13 ++++++++++ .../sketch_2021_03_28c.pyde | 14 ++++++++++ .../sketch_2021_03_28d.pyde | 18 +++++++++++++ .../sketch_2021_03_28e.pyde | 26 +++++++++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 2021/sketch_2021_03_28a/sketch_2021_03_28a.pyde create mode 100644 2021/sketch_2021_03_28b/sketch_2021_03_28b.pyde create mode 100644 2021/sketch_2021_03_28c/sketch_2021_03_28c.pyde create mode 100644 2021/sketch_2021_03_28d/sketch_2021_03_28d.pyde create mode 100644 2021/sketch_2021_03_28e/sketch_2021_03_28e.pyde diff --git a/2021/sketch_2021_03_28a/sketch_2021_03_28a.pyde b/2021/sketch_2021_03_28a/sketch_2021_03_28a.pyde new file mode 100644 index 00000000..48634d07 --- /dev/null +++ b/2021/sketch_2021_03_28a/sketch_2021_03_28a.pyde @@ -0,0 +1,12 @@ +def setup(): + size(650, 650) + background(0, 0, 200) + + total = 0 + while total < 600: + largura = random(32) + fill(largura * 8) + rect(25 + total, 25, largura, 600) + total += largura + # note que nesta versão o valor total + # pode passar de 600 diff --git a/2021/sketch_2021_03_28b/sketch_2021_03_28b.pyde b/2021/sketch_2021_03_28b/sketch_2021_03_28b.pyde new file mode 100644 index 00000000..97df93f7 --- /dev/null +++ b/2021/sketch_2021_03_28b/sketch_2021_03_28b.pyde @@ -0,0 +1,13 @@ +def setup(): + size(650, 650) + background(0) + colorMode(HSB) + for y in range(25, 601, 30): + total = 0 + while total < 600: + largura = random(32) + fill(largura * 8, 200, 200) + rect(25 + total, y, largura, 30) + total += largura + # note que nesta versão o valor total + # pode passar de 600 diff --git a/2021/sketch_2021_03_28c/sketch_2021_03_28c.pyde b/2021/sketch_2021_03_28c/sketch_2021_03_28c.pyde new file mode 100644 index 00000000..3bce322d --- /dev/null +++ b/2021/sketch_2021_03_28c/sketch_2021_03_28c.pyde @@ -0,0 +1,14 @@ +def setup(): + size(650, 650) + background(0) + colorMode(HSB) + for y in range(25, 601, 30): + total = 0 + while total < 600: + largura = int(random(1, 32)) + if total + largura <= 600: + fill(largura * 8, 200, 200) + rect(25 + total, y, largura, 30) + total += largura + print total + diff --git a/2021/sketch_2021_03_28d/sketch_2021_03_28d.pyde b/2021/sketch_2021_03_28d/sketch_2021_03_28d.pyde new file mode 100644 index 00000000..d6adf42d --- /dev/null +++ b/2021/sketch_2021_03_28d/sketch_2021_03_28d.pyde @@ -0,0 +1,18 @@ +def setup(): + size(650, 650) + background(0) + colorMode(HSB) + total_h = 0 + while total_h < 600: + total_w = 0 + h = int(random(1, 33)) + if total_h + h <= 600: + while total_w < 600: + w = int(random(1, 33)) + if total_w + w <= 600: + fill(w * 8, 200, h * 8) + rect(25 + total_w, + 25 + total_h, w, h) + total_w += w + total_h += h + diff --git a/2021/sketch_2021_03_28e/sketch_2021_03_28e.pyde b/2021/sketch_2021_03_28e/sketch_2021_03_28e.pyde new file mode 100644 index 00000000..fe42e5fe --- /dev/null +++ b/2021/sketch_2021_03_28e/sketch_2021_03_28e.pyde @@ -0,0 +1,26 @@ +def setup(): + size(650, 650) + +def draw(): + background(0) + total_h = 0 + while total_h < 600: + total_w = 0 + nh = noise(total_w * 0.005, + total_h * 0.005, + frameCount * 0.001) + true_h = h = 36 * nh + if total_h + h > 600: + h = 600 - total_h + while total_w < 600: + nw = noise(total_w * 0.005, + total_h * 0.005, + frameCount * 0.001) + w = 36 * nw + fill(0, w * 8, true_h * 8) + if total_w + w > 600: + w = 600 - total_w + rect(25 + total_w, + 25 + total_h, w, h) + total_w += w + total_h += h