Animations reference¶
Animation types live in the inkflow.animations namespace. Each takes the shared
Cue params (element, trigger) plus the
Animation timing/playback params (duration, easing, delay,
iterations) and any of its own. element is the target's id; trigger is a
Trigger that decides the cue's step.
direction fields use the Direction
enum and easing the Easing type.
from inkflow import animations, Direction, Trigger
Slide(
"01.svg",
animations=[
animations.FadeIn("headline"),
animations.SlideIn(
"box", Trigger.WITH_PREVIOUS, direction=Direction.LEFT, duration=0.6
),
],
)
Every built-in subclasses one of the semantic bases Enter,
Exit, or Emphasis, which
fix its AnimationKind. The kind lets several cues target one
element and compose into a single lifecycle: an element can enter, be emphasized, and
exit at different steps, and re-enter after an exit. Enters reveal, exits hide, and
emphasis fires momentarily without changing visibility.
Custom animations subclass a semantic base and write a matching
@keyframes anim-<slug> rule (the kebab-cased type name) in a styles.css next to
deck.py. No JavaScript is involved: the step engine reads the keyframes and drives
them. Any extra field is substituted wherever it appears as var(--anim-<field>).
from dataclasses import dataclass
from inkflow import animations
@dataclass
class Glow(animations.Emphasis):
intensity: float = 1.0 # → var(--anim-intensity) in @keyframes anim-glow
The animations namespace also holds PlayVideo,
a non-animating cue that starts a Video on a step.
Built-in animation types for the deck DSL.
The base Animation (element + trigger from Cue, plus duration/easing/
delay) lives here alongside the three semantic bases Enter, Exit, and
Emphasis, which fix the animation's AnimationKind. Concrete types are thin
subclasses of those bases, adding only their own fields. This namespace also holds
PlayVideo, the non-animating video cue that shares the same step timeline.
How a type maps to CSS:
- The step engine drives each cue via the Web Animations API, reading the
@keyframes anim-<slug>rule whose 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@keyframesrule," nothing else. - Every field becomes part of the cue's serialized params. Timing fields
(
duration/easing/delay) drive theelement.animate()options; the rest are substituted into the keyframes wherever they appear as avar(--anim-<field>)token (e.g.var(--anim-distance)), leaving other custom properties likevar(--accent)for the browser to resolve. kinddecides how several cues on one element compose: enters reveal, exits hide, emphasis fires momentarily without changing visibility.
Cue
dataclass
¶
Base for anything on a slide's step timeline.
Carries just the target element and the trigger that decides its step.
Animation adds timing on top; PlayVideo is a sibling that carries no timing.
Animation
dataclass
¶
Bases: Cue, Slugged
Base for every animation type.
Concrete types subclass one of Enter / Exit / Emphasis (which fix the
AnimationKind), adding their own fields. element/trigger come from Cue;
duration, easing, and delay are shared keyword-only timing params.
Custom animations. Subclass a semantic base in deck.py — no changes to
inkflow are needed. Write a matching @keyframes rule named after the kebab-cased
type (MyGlow → @keyframes anim-my-glow) in a styles.css next to
deck.py (loaded automatically). Any extra field is substituted into the
keyframes wherever it appears as var(--anim-<field>).
from inkflow import animations
@dataclass
class MyGlow(animations.Emphasis):
intensity: float = 1.0 # → var(--anim-intensity) in @keyframes anim-my-glow
kind
class-attribute
¶
The animation's lifecycle role. Overridden by the semantic base classes; a bare
Animation subclass defaults to an enter.
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.
iterations
class-attribute
instance-attribute
¶
How many times the animation repeats. Mostly useful for an emphasis like
Highlight (pulse iterations times); enters/exits normally leave it at 1.
Enter
dataclass
¶
Exit
dataclass
¶
Emphasis
dataclass
¶
PlayVideo
dataclass
¶
Bases: Cue
Start a video on a step instead of on load.
element is the zone key of a Video, e.g. "media" for
zones={"media": Video(...)}. At its step the clip plays; stepping back
resets it.
If the video also sets autoplay=True, the cue wins and autoplay is dropped.
Bounce
dataclass
¶
Bases: Enter
Element starts hidden just below its place and springs up into it on its step.
duration
class-attribute
instance-attribute
¶
Duration in seconds.
easing
class-attribute
instance-attribute
¶
Easing curve — defaults to a spring that overshoots past the resting position and settles back, which is what gives the bounce its character.
distance
class-attribute
instance-attribute
¶
How far below its resting place the element starts, in SVG user units.
SlideIn
dataclass
¶
ZoomIn
dataclass
¶
SlideOut
dataclass
¶
ZoomOut
dataclass
¶
Cue (base)¶
Base for anything on a slide's step timeline.
Carries just the target element and the trigger that decides its step.
Animation adds timing on top; PlayVideo is a sibling that carries no timing.
Animation (base)¶
Bases: Cue, Slugged
Base for every animation type.
Concrete types subclass one of Enter / Exit / Emphasis (which fix the
AnimationKind), adding their own fields. element/trigger come from Cue;
duration, easing, and delay are shared keyword-only timing params.
Custom animations. Subclass a semantic base in deck.py — no changes to
inkflow are needed. Write a matching @keyframes rule named after the kebab-cased
type (MyGlow → @keyframes anim-my-glow) in a styles.css next to
deck.py (loaded automatically). Any extra field is substituted into the
keyframes wherever it appears as var(--anim-<field>).
from inkflow import animations
@dataclass
class MyGlow(animations.Emphasis):
intensity: float = 1.0 # → var(--anim-intensity) in @keyframes anim-my-glow
kind
class-attribute
¶
The animation's lifecycle role. Overridden by the semantic base classes; a bare
Animation subclass defaults to an enter.
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.
iterations
class-attribute
instance-attribute
¶
How many times the animation repeats. Mostly useful for an emphasis like
Highlight (pulse iterations times); enters/exits normally leave it at 1.