Python Animation Tutorial-EASY!
Hey! This is SilvermoonCat :D
Let's learn how to make python animations today-- it's pretty easy, so anyone will understand!
First, get a blank repl in python set up.
IN there, add a folder and name it
frame (can be modified later). In the folder, you will
later have files named "frame1" "frame2" etc for the art. Let's move on for now--
Now go to the file main.py and import time and os:
i is our variable.
To make everything easier, let's define some functions...
Great! Now go make your art :> In the folder "frame",
add a file named
frame1. Make your first picture/frame there, then create
a file named
frame2, and so on.
If you don't get animations, they're basically pictures connected together
to make a moving picture (aka an animation).
You can scroll ↓ for the example :P
Ok so we have to connect the pictures.
I'll explain everything here:
this is simple, just makes the whole thing go in a loop. Aka makes the animation
i = 0
I know we already asssigned this variable, just add it here in case. Basically,
the read() function reads files called
frame i+1, so if we put i as 0 here,
it will read the file frame1 (continue reading and this will become clear. ;)
Here, the read function makes the computer print out frame1, your first picture.
time.sleep(0.5) will pause everything briefly, for half a second here, before
clear() clears the board.
but that is only 1 frame...
Now, just keep copy and pasting this:
Everytime you do it, increase
i by one.
what I mean is
and so on, so that all your files get printed.
You're probably still confused, since I'm not very good at explaining :'(
☆ Scroll down for the example I made ☆