.. include:: headings.inc .. currentmodule:: adv .. _adv.Animation: ========================================================================================================================================== |phoenix_title| **Animation** ========================================================================================================================================== This class encapsulates the concept of a platform-dependent animation. An animation is a sequence of frames of the same size. Sound is not supported by :ref:`adv.Animation`. Note that on wxGTK :ref:`adv.Animation` is capable of loading the formats supported by the internally-used ``gdk-pixbuf`` library (typically this means only ``ANIMATION_TYPE_GIF`` ). On other platforms :ref:`adv.Animation` is always capable of loading both ``GIF`` and ``ANI`` formats (i.e. both ``ANIMATION_TYPE_GIF`` and ``ANIMATION_TYPE_ANI`` ). .. seealso:: :ref:`adv.AnimationCtrl`, | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **Animation** .. raw:: html

Inheritance diagram of Animation

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~Animation.__init__` Default constructor. :meth:`~Animation.GetDelay` Returns the delay for the i-th frame in milliseconds. :meth:`~Animation.GetFrame` Returns the i-th frame as a :ref:`Image`. :meth:`~Animation.GetFrameCount` Returns the number of frames for this animation. :meth:`~Animation.GetSize` Returns the size of the animation. :meth:`~Animation.IsOk` Returns ``True`` if animation data is present. :meth:`~Animation.Load` Loads an animation from the given stream. :meth:`~Animation.LoadFile` Loads an animation from a file. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~Animation.FrameCount` See :meth:`~Animation.GetFrameCount` :attr:`~Animation.Size` See :meth:`~Animation.GetSize` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: Animation(GDIObject) This class encapsulates the concept of a platform-dependent animation. **Possible constructors**:: Animation() Animation(anim) Animation(name, type=ANIMATION_TYPE_ANY) .. method:: __init__(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **__init__** `(self)` Default constructor. **~~~** **__init__** `(self, anim)` Copy constructor. :param `anim`: :type `anim`: adv.Animation **~~~** **__init__** `(self, name, type=ANIMATION_TYPE_ANY)` Loads an animation from a file. :param `name`: The name of the file to load. :type `name`: string :param `type`: See :meth:`LoadFile` for more info. :type `type`: AnimationType **~~~** .. method:: GetDelay(self, i) Returns the delay for the i-th frame in milliseconds. If ``-1`` is returned the frame is to be displayed forever. :param `i`: :type `i`: int :rtype: `int` .. method:: GetFrame(self, i) Returns the i-th frame as a :ref:`Image`. This method is not implemented in the native wxGTK implementation of this class and always returns an invalid image there. :param `i`: :type `i`: int :rtype: :ref:`Image` .. method:: GetFrameCount(self) Returns the number of frames for this animation. This method is not implemented in the native wxGTK implementation of this class and always returns 0 there. :rtype: `int` .. method:: GetSize(self) Returns the size of the animation. :rtype: :ref:`Size` .. method:: IsOk(self) Returns ``True`` if animation data is present. :rtype: `bool` .. method:: Load(self, stream, type=ANIMATION_TYPE_ANY) Loads an animation from the given stream. :param `stream`: The stream to use to load the animation. Under wxGTK may be any kind of stream; under other platforms this must be a seekable stream. :type `stream`: InputStream :param `type`: One of the :meth:`AnimationType` enumeration values. :type `type`: AnimationType :rtype: `bool` :returns: ``True`` if the operation succeeded, ``False`` otherwise. .. method:: LoadFile(self, name, type=ANIMATION_TYPE_ANY) Loads an animation from a file. :param `name`: A filename. :type `name`: string :param `type`: One of the :meth:`AnimationType` values; ``ANIMATION_TYPE_ANY`` means that the function should try to autodetect the filetype. :type `type`: AnimationType :rtype: `bool` :returns: ``True`` if the operation succeeded, ``False`` otherwise. .. attribute:: FrameCount See :meth:`~Animation.GetFrameCount` .. attribute:: Size See :meth:`~Animation.GetSize`