Alexandre B A Villares 2019-09-24 00:34:22 -03:00
rodzic 1ee7563329
commit f87244a23e
4 zmienionych plików z 78 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,44 @@
"""
Alexandre B A Villares http://abav.lugaralgum.com - GPL v3
A helper for the Processing gifAnimation library https://github.com/extrapixel/gif-animation/tree/3.0
Download from https://github.com/villares/processing-play/blob/master/export_GIF/unzip_and_move_to_libraries_GifAnimation.zip
This helper was inspired by an example by Art Simon https://github.com/APCSPrinciples/AnimatedGIF/
v2019_09_23
# add at the start of your sketch:
add_library('gifAnimation')
from gif_animation_helper import gif_export
# add at the end of draw():
gif_export(GifMaker, "filename")
"""
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=255, # quality range 0 - 255
delay=170, # this is quick
frames=0, # 0 will stop on keyPressed or frameCount >= 100000
finish=False): # force stop
global gifExporter
try:
gifExporter
except NameError:
gifExporter = GifMaker(this, filename + ".gif")
gifExporter.setRepeat(repeat)
gifExporter.setQuality(quality)
gifExporter.setDelay(delay)
print("gif recording started")
gifExporter.addFrame()
if (frames == 0 and keyPressed and key == "e" or
frames != 0 and frameCount >= frames):
finish = True
if finish:
gifExporter.finish()
print("gif saved, exit")
exit()

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 3.9 MiB

Wyświetl plik

@ -0,0 +1,19 @@
add_library('gifAnimation')
from gif_animation_helper import gif_export
#つぶやきProcessing
w,h=500,250
def setup():size(w,w);noStroke();fill(0,10)
def draw():
background(h/2,h,h/2);translate(h,h)
a,k=0,sin(frameCount/30.)
while a<TWO_PI:
i,j=sin(a),cos(a)
n=h*noise((abs(i)+i+j),(abs(j)+j+i),k)
square(n*i-n/6,n*j-n/6,n/3)
a+=.004
if frameCount/30. < TWO_PI:
gif_export(GifMaker, filename="b")
else:
gif_export(GifMaker, finish=True)

Wyświetl plik

@ -20,6 +20,21 @@ You may also support my artistic work, open teaching resources and research with
---
![sketch_190924c](2019/sketch_190924c/sketch_190924c.gif)
[sketch_190924c](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190924c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
---
![sketch_190923c](2019/sketch_190923c/sketch_190923c.gif)
[sketch_190923c](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190923c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
---
![sketch_190922c](2019/sketch_190923c/sketch_190922c.gif)
<blockquote class="twitter-tweet"><p lang="en" dir="ltr"><a href="https://twitter.com/hashtag/%E3%81%A4%E3%81%B6%E3%82%84%E3%81%8DProcessing?src=hash&amp;ref_src=twsrc%5Etfw">#つぶやきProcessing</a> <a href="https://twitter.com/hashtag/Python?src=hash&amp;ref_src=twsrc%5Etfw">#Python</a><br>w,h=500,250<br>def setup():size(w,w)<br>def draw():<br> background(h/2,h/2,h);translate(h,h)<br> a,k=0,sin(frameCount/30.)<br> while a&lt;TWO_PI:<br> i,j=sin(a),cos(a)<br> n=noise((abs(i)+i+j),(abs(j)+j+i),k)<br> x,y=n*h*sin(a),n*h*cos(a)<br> line(0,0,x,y)<br> a+=.004 <a href="https://t.co/ygkwh2KKxG">pic.twitter.com/ygkwh2KKxG</a></p>&mdash; Alexandre B A Villares ☂ (@villares) <a href="https://twitter.com/villares/status/1175856215030665216?ref_src=twsrc%5Etfw">September 22, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
[sketch_190922a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190922a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]