Creating Animations
Compose built-in animations first. Sequence runs animations in order and
Bundle runs them concurrently; seq.show(seconds) inserts a hold.
from manifest import AbsoluteTransition, Move, Position, Sequence
def blink(entity):
return Sequence(
AbsoluteTransition('opacity', entity, 0, time=.2),
AbsoluteTransition('opacity', entity, 1, time=.2),
)
seq.show(blink(meter.fill))
seq.show(Move(meter, Position(100, 0), time=1))
Avoid overlapping animations that write the same property. For reusable
branches, use seq.build_sequence(callback, *args) and insert the result with
seq.show(branch). A custom animation may implement timeline(); return its
relative timeline and leave it immutable after insertion.
For a named animation class, delegate to a built-in timeline:
class Slide:
def __init__(self, entity, delta):
self.animation = Move(entity, delta, time=1)
def timeline(self):
return self.animation.timeline()
Move is relative; use MoveTo or AbsoluteTransition for an absolute end
value. Construct entities in a stable order because sequence structure
contributes to generated IDs.