22 lines
598 B
Python
22 lines
598 B
Python
import math
|
|
|
|
|
|
class Animation:
|
|
def __init__(self, images, image_duration=0.125, loop=True):
|
|
|
|
if not images:
|
|
raise ValueError("Eine Animation benötigt mindestens ein Bild.")
|
|
if not math.isfinite(image_duration) or image_duration <= 0:
|
|
raise ValueError("Die Bilddauer muss endlich und größer als null sein.")
|
|
|
|
|
|
self.images = images
|
|
self.image_duration = image_duration
|
|
self.loop = loop
|
|
self.time = 0.0
|
|
self.done = False
|
|
|
|
def copy(self):
|
|
return Animation(self.images, self.image_duration, self.loop)
|
|
|
|
|