Animation — Kivy v1.0.1-dev documentation

# Animation

These classes are intended to be used on a `Widget`. If you want to add animations to your application, you need to follow two steps:

> - First, setup the animation object
> - Then, use the animation on one or multiple widgets

## Simple animation

You can animate multiple properties at the same time, with custom transition function. Here is an example to animate the widget on a custom position and size, using ‘in_quad’ transition

    widget = Widget()
    animation = Animation(x=50, size=(80, 80), t='in_quad')
    animation.start(widget)

## Sequential animation

Multiple animation can be added. The result will be animated in sequential

    widget = Widget()
    animation = Animation(x=50) + Animation(size=(80, 80))
    animation.start(widget)

## Parallel animation

You can join one or multiple animation in parallel. This can be used when you want to use differents settings for each properties

    widget = Widget()
    animation = Animation(pos=(80, 10))
    animation &= Animation(size=(800, 800), duration=2.)

class `kivy.animation.` `Animation`(**kw)

  Bases: `kivy.event.EventDispatcher`

  Create an animation definition, that can be used to animate a widget

  Parameters : | duration or d: float, default to 1. Duration of the animation transition or t: str or func Transition function for animate properties
  Events : | on_start: widget Fired when the animation is started on a widget on_complete: widget Fired when the animation is completed or stopped on a widget on_progress: widget, progression Fired when the progression of the animation is changing

  `duration`

    Return the duration of the animation

  `properties`

    Return the properties used to animate

  `start`(widget)

    Start the animation on a widget

  `stop`(widget)

    Stop the animation previously applied on a widget

  static `stop_all`(widget, *largs)

    Stop all animations that concern a specific widget / list of properties.

    Example

        widget = Widget()
        animation = Animation(x=50)
        animation.start(widget)

        # and later
        Animation.stop_all(widget, 'x')

  `stop_property`(widget, prop)

    Even if a animation is going, remove a property for beeing animated.

  `transition`

    Return the transition of the animation

class `kivy.animation.` `AnimationTransition`

  Bases: `object`

  Collection of animation function, to be used with Animation object. Easing Functions ported into Kivy from Clutter Project http://www.clutter-project.org/docs/clutter/stable/ClutterAlpha.html