diff --git a/s154/s154.pyde b/s154/s154.pyde index e307f021..7260f16e 100644 --- a/s154/s154.pyde +++ b/s154/s154.pyde @@ -17,8 +17,8 @@ def draw(): n_max, n_min = 0.5, 0.5 for x in range(cols): for y in range(cols): - n = noise((mouseX + x) * perlinScale, - (mouseY + y) * perlinScale, + n = noise((mx + x) * perlinScale, + (my + y) * perlinScale, z * perlinScale) if n > n_max: n_max = n @@ -38,5 +38,5 @@ def draw(): my += 1 z += 1 - if frameCount <= 50: saveFrame(OUTPUT) + #if frameCount <= 50: saveFrame(OUTPUT) # Gif exporter lib did not work well for the colours! :( diff --git a/s155/.gif b/s155/.gif new file mode 100644 index 00000000..9d9c4b0b Binary files /dev/null and b/s155/.gif differ diff --git a/s155/gif_export_wrapper.py b/s155/gif_export_wrapper.py new file mode 100644 index 00000000..ed24d706 --- /dev/null +++ b/s155/gif_export_wrapper.py @@ -0,0 +1,44 @@ +""" +Alexandre B A Villares http://abav.lugaralgum.com - GPL v3 + +A helper for the Processing gifAnimation library (https://github.com/jordanorelli) +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 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 + repeat=0, # 0 makes it an "endless" animation + quality=48, # quality range 0 - 255 + delay=170, # this is quick + frames=0): # 0 will stop on keyPressed or frameCount >= 100000 + global gifExporter + try: + gifExporter + except NameError: + gifExporter = GifMaker(this, filename + ".gif") + gifExporter.setRepeat(repeat) + gifExporter.setQuality(quality) + gifExporter.setDelay(delay) + gif_export._frame = frameCount + print("gif start") + + gifExporter.addFrame() + + if (frames == 0 and keyPressed or frameCount - gif_export._frame >= 100000) \ + or (frames != 0 and frameCount - gif_export._frame >= frames): + gifExporter.finish() + #background(255) + print("gif saved") + del(gifExporter) + noLoop() + return False + else: + return True diff --git a/s155/s155.gif b/s155/s155.gif new file mode 100644 index 00000000..0453f0c9 Binary files /dev/null and b/s155/s155.gif differ diff --git a/s155/s155.pyde b/s155/s155.pyde new file mode 100644 index 00000000..e307f021 --- /dev/null +++ b/s155/s155.pyde @@ -0,0 +1,42 @@ +# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day +SKETCH_NAME, OUTPUT = "s154", "###.png" # 180603 + +perlinScale = 0.1 +mx, my, z = 0, 0, 0 + +def setup(): + size(500, 500) # define o tamanho da tela em pixels. Largura X Altura + noStroke() + colorMode(HSB) + +def draw(): + global mx, my, z + background(0) + cols = 50 + tam = width / cols + n_max, n_min = 0.5, 0.5 + for x in range(cols): + for y in range(cols): + n = noise((mouseX + x) * perlinScale, + (mouseY + y) * perlinScale, + z * perlinScale) + if n > n_max: + n_max = n + if n < n_min: + n_min = n + + for x in range(cols): + for y in range(cols): + n = noise((mx + x) * perlinScale, + (my + y) * perlinScale, + z * perlinScale) + nn = map(n, n_min, n_max, 0, 255) + fill(nn, 255, 255) + ellipse(tam / 2 + x * tam, tam / 2 + y * tam, + tam - 1, tam - 1) + mx += 1 + my += 1 + z += 1 + + if frameCount <= 50: saveFrame(OUTPUT) + # Gif exporter lib did not work well for the colours! :(