An attempt at displaying GIF animations inside a sketch #638
villares
started this conversation in
Show and tell
Replies: 3 comments
-
Runs ok with Imported mode for py5. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I like this. Great way to incorporate a GIF into a Sketch. PIL is in awesome library for working with GIFs |
Beta Was this translation helpful? Give feedback.
0 replies
-
The following is an alternate technique for playing a .gif inside a sketch. It utilizes a JavaFX imageView in a default Processing window. The .gif file may be loaded from your sketch folder. # Uses Imported mode for py5
import java.io.FileInputStream
from javafx.scene.image import Image
from javafx.scene.image import ImageView
def setup():
global inputFile
size(800, 800, FX2D)
window_title('JavaFX Button in Default Window')
canvas = get_surface().get_native()
root = canvas.getParent()
inputFile = java.io.FileInputStream("arvores.gif")
myImage = Image(inputFile)
imageView = ImageView(myImage)
root.getChildren().add(imageView) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
py5 can export GIF animations (check out
py5_tools.animated_gif()
) but how to draw an existing GIF inside your sketch?This is an experiment (with lots of commented out print debugging lines) I tried some time ago.
I guess someone could try to make it a class mode thing so it becomes more robust and reusable, or add override options for the delay and looping...
If you need a GIF to try out:
arvores.gif
Beta Was this translation helpful? Give feedback.
All reactions