Kivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.
Animation and AnimationTransition are used to animate Widget properties. You must specify at least a property name and target value. To use Animation, follow these steps:
- Setup an Animation object
- Use the Animation object on a Widget
To use animation you must have to import:
from kivy.animation import Animation
Basic Approaches: 1) import runTouchApp 2) import Builder 3) import Widget 4) import Animation 5) import Clock 6) import Window 7) import random 8) import listproperty 9) Build the .kv file 10) Create root class 11) Create the clock and anim react class used to animate the boxes 12) Run the App
In the below example we are creating the two boxes (red and green) in which we are giving animations to the red box i.e when the App starts the red box is in its animated view but to clear the concepts i am providing the green box which on click provide random animations i.e it goes anywhere at random.
The program consists of two main classes first is clock class which is for the red box as we are declaring it animated and the green box animation is in anim class.
To provide the motion you must have to play with velocity.
Implementation of the Approach:
Animated Output vedio:
- Python | Animation in Kivy
- Python | Kivy .kv File
- Python | Canvas in Kivy using .kv file
- Python | ScreenManager in Kivy using .kv file
- Python | AnchorLayout in Kivy using .kv file
- Python | Accordion in kivy using .kv file
- Python | File chooser in kivy
- Python | TextInput in kivy using .kv file
- Python | FloatLayout in Kivy using .kv file
- Python | StackLayout in Kivy using .kv file
- Python | PageLayout in Kivy using .kv file
- Python | Popup widget in Kivy using .kv file
- Python | Grid Layout in Kivy without .kv file
- Python | Spinner widget in Kivy using .kv file
- Python | Adding image in Kivy using .kv file
- Python | Toggle button in kivy using .kv file
- Python | Working with buttons in Kivy with .kv file
- Python | Switch widget in Kivy using .kv file
- Python | Progressbar widget in kivy using .kv file
- Python | Relative Layout in Kivy using .kv file
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.