Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Kivy - Interactive Applications and Games in Python

You're reading from  Kivy - Interactive Applications and Games in Python

Product type Book
Published in Jun 2015
Publisher
ISBN-13 9781785286926
Pages 206 pages
Edition 1st Edition
Languages
Author (1):
Roberto Ulloa Roberto Ulloa
Profile icon Roberto Ulloa

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
1. GUI Basics – Building an Interface 2. Graphics – the Canvas 3. Widget Events – Binding Actions 4. Improving the User Experience 5. Invaders Revenge – an Interactive Multi-touch Game 6. Kivy Player – a TED Video Streamer 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...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}