Book Image

Kivy - Interactive Applications and Games in Python

By : Roberto Ulloa
Book Image

Kivy - Interactive Applications and Games in Python

By: Roberto Ulloa

Overview of this book

Table of Contents (13 chapters)
Kivy – Interactive Applications and Games in Python Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Combining animations with '+' and '&'


You already learned that you can add several properties to the same animation so that they are modified together (line 69 of ammo.py).

Note

We can combine animations by using the + and & operators. The + operator is used to create sequenced animations (one after another). The & operator lets us execute two animations at the same time.

The following code is fragment 2 of main.py, and illustrates the use of these two operators:

319. # File name: main.py (Fragment 2)
320.   def end_game(self, message):
321.     label = Label(markup=True, size_hint = (.2, .1), 
322.       pos=(0,self.parent.height/2), text = message)
323.     self.add_widget(label)
324.     self.composed_animation().start(label)
325. 
326.   def composed_animation(self):
327.     animation = Animation (center=self.parent.center)
328.     animation &= Animation (font_size = 72, d=3)
329.     animation += Animation(font_size = 24,y=0,d=2)
330.     return animation
331. 
332. class...