From fca9282f10cbe2e26a0f8a28b844cd045ad3fcf2 Mon Sep 17 00:00:00 2001 From: Alexandre B A Villares Date: Thu, 29 Mar 2018 22:30:08 -0300 Subject: [PATCH] clean up --- s087/s087.pyde | 15 +++++---------- s088/gif_exporter.py | 7 +++++-- s088/s088.pyde | 9 +-------- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/s087/s087.pyde b/s087/s087.pyde index 6bc86b07..4436cd55 100644 --- a/s087/s087.pyde +++ b/s087/s087.pyde @@ -23,7 +23,6 @@ COLORS = [color(0), color(0), color(0), def setup(): size(600, 600, P2D) - colorMode(HSB) rectMode(CENTER) A.position(40, height - 70) @@ -47,17 +46,16 @@ def draw(): x = int(random(width - tam) / c) * c y = int(random(height - tam) / c) * c stroke(rnd_choice(COLORS)) - noFill() # fill(rnd_choice(COLORS), 100) strokeWeight(int(random(1, 3))) random_a = rnd_choice(range(1, a + 1)) grid(x, y, random_a, b, c, rnd_choice(SHAPES)) # uncomment next lines to export GIF - if not frameCount % 30: - gif_export(GifMaker, - frames=2000, - delay=500, - filename=SKETCH_NAME) + # if not frameCount % 30: + # gif_export(GifMaker, + # frames=2000, + # delay=500, + # filename=SKETCH_NAME) # Draws sliders and checks for mouse dragging or keystrokes Slider.update_all() @@ -70,6 +68,3 @@ def grid(x, y, num, size_, space, func): def rnd_choice(collection): i = int(random(len(collection))) return collection[i] - -# def keyPressed(): -# saveFrame(SKETCH_NAME + '_###.gif') diff --git a/s088/gif_exporter.py b/s088/gif_exporter.py index 6f54c524..dbb58014 100644 --- a/s088/gif_exporter.py +++ b/s088/gif_exporter.py @@ -6,8 +6,11 @@ ported to Processing 3 by 01010101 (https://github.com/01010101) Download the library from https://github.com/01010101/GifAnimation/archive/master.zip This helper was inspired by an example by Art Simon https://github.com/APCSPrinciples/AnimatedGIF/ -Put add_library('gifAnimation') at the start of your sketch -and add gif_export(GifMaker) at the end of draw() +Put at the start of your sketch: + add_library('gifAnimation') + from gif_exporter import gif_export +and at the end of draw(): + gif_export(GifMaker) """ def gif_export(GifMaker, # gets a reference to the library filename="exported", # .gif will be added diff --git a/s088/s088.pyde b/s088/s088.pyde index 91229aed..b16b4db3 100644 --- a/s088/s088.pyde +++ b/s088/s088.pyde @@ -18,9 +18,6 @@ SHAPES = [my_ellipse, def setup(): size(600, 600, P2D) - colorMode(HSB) - rectMode(CENTER) - A.position(40, height - 70) B.position(40, height - 30) C.position(width - 140, height - 70) @@ -28,8 +25,7 @@ def setup(): def draw(): background(200) - noFill() - + a = int(A.val) # number of elements b = C.val * B.val / 100 # size of el ements (B.val % of spacing!) c = int(C.val) # spacing between elements @@ -64,6 +60,3 @@ def grid(x, y, num, size_, space, func): def rnd_choice(collection): i = int(random(len(collection))) return collection[i] - -# def keyPressed(): -# saveFrame(SKETCH_NAME + '_###.gif')