animationΒΆ

Domonic includes a practical first pass of the Web Animations surface.

That includes:

  • Animation

  • AnimationPlaybackEvent

  • EffectTiming

  • ComputedEffectTiming

  • AnimationEffect

  • KeyframeEffect

  • DocumentTimeline on the document side

  • Element.animate(...) wired into the DOM

Quick example:

from domonic.html import div

box = div(_id="box")
animation = box.animate(
    [
        {"opacity": 0, "transform": "translateX(0px)"},
        {"opacity": 1, "transform": "translateX(100px)"},
    ],
    {"duration": 1000, "fill": "forwards"},
)

animation.play()
class domonic.animation.Animation(effect: AnimationEffect | None = None, timeline: Any = None, *, id: str = '')[source]
class domonic.animation.AnimationEffect(timing: EffectTiming | dict[str, Any] | None = None)[source]

Base class for effects that can be sampled over time and applied to targets.

class domonic.animation.AnimationPlaybackEvent(_type: str, options: dict[str, Any] | None = None, *args, **kwargs)[source]

Event carrying playback timing information for animation lifecycle hooks.

class domonic.animation.ComputedEffectTiming(timing: EffectTiming | None = None, *, activeDuration: float = 0.0, currentIteration: int | None = None, endTime: float = 0.0, progress: float | None = None)[source]

Resolved timing data derived from an effect plus a current local time.

class domonic.animation.EffectTiming(delay: float = 0.0, direction: str = 'normal', duration: float = 0.0, easing: str = 'linear', endDelay: float = 0.0, fill: str = 'none', iterationStart: float = 0.0, iterations: float = 1.0)[source]

Timing parameters shared by animation effects.

This is the author-facing timing object that describes delay, duration, direction, fill mode, easing, and iteration behaviour.

class domonic.animation.KeyframeEffect(target: Any, keyframes: list[dict[str, Any]] | dict[str, Any], options: EffectTiming | dict[str, Any] | None = None)[source]

Keyframe-based effect bound to a target object or DOM element.