kopia lustrzana https://github.com/villares/sketch-a-day
190330a
rodzic
72e43fc845
commit
be67cfe166
Plik binarny nie jest wyświetlany.
|
Przed Szerokość: | Wysokość: | Rozmiar: 731 KiB Po Szerokość: | Wysokość: | Rozmiar: 104 KiB |
|
|
@ -0,0 +1,40 @@
|
|||
"""
|
||||
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/
|
||||
|
||||
# add at the start of your sketch:
|
||||
add_library('gifAnimation')
|
||||
from gif_exporter import gif_export
|
||||
# add 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=255, # quality range 0 - 255
|
||||
delay=200, # 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)
|
||||
|
||||
gifExporter.addFrame()
|
||||
|
||||
if frames == 0:
|
||||
if keyPressed and key == "e":
|
||||
finish = True
|
||||
|
||||
if finish:
|
||||
gifExporter.finish()
|
||||
print("gif saved")
|
||||
exit()
|
||||
Plik binarny nie jest wyświetlany.
|
Po Szerokość: | Wysokość: | Rozmiar: 180 KiB |
|
|
@ -1,7 +1,14 @@
|
|||
# Alexandre B A Villares - https://abav.lugaralgum.com/sketch-a-day
|
||||
from __future__ import division
|
||||
from random import choice
|
||||
from arcs import poly_filleted
|
||||
add_library('GifAnimation')
|
||||
from gif_exporter import gif_export
|
||||
|
||||
"""
|
||||
Oh, the difference a grid makes!
|
||||
"""
|
||||
SKETCH_NAME, OUTPUT = "sketch_190330a", ".gif"
|
||||
SPACING, MARGIN = 100, 100
|
||||
X_LIST, Y_LIST = [], [] # listas de posições para elementos
|
||||
rad_list = [10, 20, 30, 40]
|
||||
|
|
@ -44,12 +51,10 @@ def poly_arc_augmented(p_list, r_list):
|
|||
if a1 and a2:
|
||||
start = a1 if a1 < a2 else a1 - TWO_PI
|
||||
arc(p2.x, p2.y, r2 * 2, r2 * 2, start, a2)
|
||||
elif a1:
|
||||
println((a1, a2))
|
||||
ellipse(p1.x, p1.y, r1 * 2, r1 * 2)
|
||||
else:
|
||||
# println((a1, a2))
|
||||
ellipse(p1.x, p1.y, r1 * 2, r1 * 2)
|
||||
ellipse(p2.x, p2.y, r2 * 2, r2 * 2)
|
||||
println((a1, a2))
|
||||
|
||||
|
||||
def circ_circ_tangent(p1, p2, r1, r2):
|
||||
|
|
@ -73,10 +78,20 @@ def circ_circ_tangent(p1, p2, r1, r2):
|
|||
return (line_angle + theta)
|
||||
else:
|
||||
line(p1.x, p1.y, p2.x, p2.y)
|
||||
return line_angle
|
||||
return None
|
||||
|
||||
def mouseClicked():
|
||||
create_list()
|
||||
|
||||
def keyPressed():
|
||||
saveFrame("s####.png")
|
||||
gif_export(GifMaker, filename=SKETCH_NAME, delay=1200)
|
||||
|
||||
# print text to add to the project's README.md
|
||||
def settings():
|
||||
println(
|
||||
"""
|
||||

|
||||
|
||||
[{0}](https://github.com/villares/sketch-a-day/tree/master/2019/{0}) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
""".format(SKETCH_NAME, OUTPUT)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,13 @@ Get updates from my sort-of-weekly newsletter: [[sketch-mail](https://villares.o
|
|||
|
||||
## 2019
|
||||
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
[sketch_190330a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190330a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
|
@ -30,7 +37,6 @@ Get updates from my sort-of-weekly newsletter: [[sketch-mail](https://villares.o
|
|||
[sketch_190329a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190329a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue