Created
October 23, 2016 12:34
-
-
Save souenzzo/8bfb9a8f85a84afef140974570f3b0a1 to your computer and use it in GitHub Desktop.
Desenhando gifs em python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Antes de executar esse programa você deve instalar as dependencias: | |
[user@pc]~ $ pip install --user moviepy gizeh | |
Então execute | |
[user@pc]~ $ python gif.py | |
Irá gerar dois gifs: "a.git", "b.gif". | |
""" | |
from moviepy.editor import VideoClip | |
import gizeh | |
s = gizeh.Surface(500,500) | |
def sem_apagar(t): | |
p = gizeh.circle(r=10, fill=(1,1,1), xy=(t*50,t*50)) | |
p.draw(s) | |
return s.get_npimage() | |
def apagando(t): | |
s = gizeh.Surface(500, 500) | |
p = gizeh.circle(r=10, fill=(1,1,1), xy=(t*50,t*50)) | |
p.draw(s) | |
return s.get_npimage() | |
a = VideoClip(sem_apagar, duration=10) | |
b = VideoClip(apagando, duration=10) | |
a.write_gif("a.gif", fps=3) | |
b.write_gif("b.gif", fps=3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment