-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_handler.py
33 lines (27 loc) · 1.25 KB
/
event_handler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from layer import Layer
from animation import *
from clock import *
from message import MessageAnimation
from swipe import SwipeAnimation
class EventHandler(object):
def __init__(self, comp, minsec):
self.comp = comp
self.minsec = minsec
def start(self):
self.main_layer = Layer(self.comp.size)
self.main_layer.add_animation(SwipeAnimation(self.main_layer.buffer, True))
self.main_layer.add_animation(MessageAnimation(self.main_layer.buffer, "Hello"))
self.layers = [self.main_layer]
self.comp.start(self.layers)
def clock_start(self):
clock_intro = ClockIntroAnimation(self.main_layer.buffer, minutes_seconds=self.minsec)
self.main_layer.add_animation(clock_intro)
self.clock = ClockAnimation(self.main_layer.buffer, intro=clock_intro, minutes_seconds=self.minsec)
self.main_layer.add_animation(self.clock)
def clock_stop(self):
clock_outro = ClockOutroAnimation(self.main_layer.buffer, self.clock)
self.main_layer.add_animation(clock_outro)
self.clock.finished = True
def stop(self, wait_for_finish=True):
self.main_layer.add_animation(MessageAnimation(self.main_layer.buffer, "Goodnight"))
self.comp.stop(wait_for_finish)