Alexandre B A Villares 2018-03-29 22:30:08 -03:00
rodzic 2f95540488
commit fca9282f10
3 zmienionych plików z 11 dodań i 20 usunięć

Wyświetl plik

@ -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')

Wyświetl plik

@ -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

Wyświetl plik

@ -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')