Animations reference¶
Animation types live in the inkflow.animations namespace. Each takes the shared
Animation params (element, step, duration, easing,
delay) plus any of its own. direction fields use the Direction enum
and easing the Easing type.
from inkflow import animations, Direction
Slide("01.svg", animations=[
animations.FadeIn("#headline", step=1),
animations.SlideIn("#box", step=2, direction=Direction.LEFT, duration=0.6),
])
Built-in animation types for the deck DSL.
Each type is a thin subclass of Animation, adding only
its own fields. The shared params (duration, easing, delay) and the
element/step fields come from the base.
How a type maps to CSS:
- The CSS class is
anim-<slug>, where the slug is the kebab-cased class name (Animation.slug()):FadeIn→anim-fade-in,SlideIn→anim-slide-in,Highlight→anim-highlight. Defining a new type is "add a subclass here + write a matching CSS rule," nothing else. - Continuous params become
--anim-<field>custom properties on the element. - Discrete params that CSS cannot branch on by value become modifier classes —
currently
direction→anim-from-{direction}.
FadeIn
dataclass
¶
Bases: Animation
Element starts hidden, fades in on its step.
FadeOut
dataclass
¶
Bases: Animation
Element starts visible, fades out on its step.
Bounce
dataclass
¶
Bases: Animation
Element starts hidden, appears with a scale-pulse bounce on its step.
SlideIn
dataclass
¶
SlideOut
dataclass
¶
ZoomIn
dataclass
¶
Bases: Animation
Element scales up into place from scale.
ZoomOut
dataclass
¶
Bases: Animation
Element scales down out of place toward scale.
Animation (base)¶
Bases: _Slugged
Data-only base for every animation type.
Concrete types live in inkflow.animations and subclass this, adding only
their own fields. The shared timing params are kw_only so they stay out of
the positional argument order, leaving the natural positional slots to each
subclass's own fields (e.g. SlideIn("#box", Direction.RIGHT) sets
direction).
Custom animations. Subclass this directly in deck.py — no changes to
inkflow are needed. The CSS class is the kebab-cased type name (MyGlow →
anim-my-glow), and each extra field becomes a --anim-<field> custom
property on the element. Put the matching CSS in a styles.css next to
deck.py (loaded automatically).
duration
class-attribute
instance-attribute
¶
Duration in seconds.
easing
class-attribute
instance-attribute
¶
Easing curve — an Easing preset (e.g. Easing.EASE_IN_OUT) or a
custom curve via Easing.cubic_bezier(...).
delay
class-attribute
instance-attribute
¶
Seconds to wait before the animation starts.