I have this idea, in which I'd like to animate a pair of robot eyes, similar to Anki's Cozmo, but instead of displaying on a LED screen, I would like to run this in a python application, while still have a similar feel/effect (slight flickering, look pixelated). The problem here is that I have not a clue where to start. Must I have all the animation sprites for all the expressions (sad, happy, angry...) and transitions, then using tkinter or pygame. Or can I just draw directly from a set of configuration (e.g. array)? It would be great if you can suggest some approaches.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
An easy way is to store the data in a simple string, and then create your surfaces from those strings. It does not need much memory while being easy to read and modify and it can live inside your code.
Of course there are a lot of different ways to do what you want, but I guess something simple like this would be a good start (you'll get the idea):
Where to go from here:
Use a smaller tile size and bigger strings to get a better resolution.
Or create the images for your animation outside of your program (in a drawing tool) and use these of you want.
Create different lists of expressions that define different animations, and change the current animation for each "mood".