Fleet – infinite concatenation of animations
In the last section we studied how we can concatenate two animations. What happens if we want to have an object that is constantly moving from right to left and vice versa? This is the case of the Fleet
: we want it constantly moving from left to right, like the yellow arrows of the following screenshot cut show:
Note
We can concatenate two animations with the on_complete
event.
The following code fragment 1 (of 2) of fleet.py
shows how to concatenate these events:
155. # File name: fleet.py (Fragment 1) 156. from kivy.uix.gridlayout import GridLayout 157. from kivy.properties import ListProperty 158. from kivy.animation import Animation 159. from kivy.clock import Clock 160. from kivy.core.window import Window 161. from random import randint, random 162. from dock import Dock 163. 164. class Fleet(GridLayout): 165. survivors = ListProperty(()) 166. 167. def __init__(self, **kwargs): 168. super(Fleet, self).__init__(**kwargs) 169. for...