## wxAnimation

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 wxAnimation.

Derived from

wxGDIObject
wxObject

Include files

<wx/animate.h>

Predefined objects

Objects:

wxNullAnimation

See also

wxAnimationCtrl

Members

wxAnimation::wxAnimation
wxAnimation::~wxAnimation
wxAnimation::GetDelay
wxAnimation::GetFrameCount
wxAnimation::GetFrame
wxAnimation::GetSize
wxAnimation::IsOk
wxAnimation::Load
wxAnimation::LoadFile
wxAnimation::operator =

### wxAnimation::wxAnimation

wxAnimation()

Default constructor.

wxAnimation(const wxAnimation& anim)

Copy constructor, uses reference counting.

wxAnimation(const wxString& name, wxAnimationType type = wxANIMATION_TYPE_ANY)

Loads an animation from a file.

name

The name of the file to load.

type

See LoadFile for more info.

### wxAnimation::~wxAnimation

~wxAnimation()

Destructor. See reference-counted object destruction for more info.

### wxAnimation::GetDelay

int GetDelay(unsigned int i) const

Returns the delay for the i-th frame in milliseconds. If `-1` is returned the frame is to be displayed forever.

### wxAnimation::GetFrameCount

unsigned int GetFrameCount() const

Returns the number of frames for this animation.

### wxAnimation::GetFrame

wxImage GetFrame(unsigned int i) const

Returns the i-th frame as a wxImage.

### wxAnimation::GetSize

wxSize GetSize() const

Returns the size of the animation.

### wxAnimation::IsOk

bool IsOk() const

Returns `true` if animation data is present.

### wxAnimation::Load

bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY)

Loads an animation from the given stream.

Parameters

stream

The stream to use to load the animation.

type

One of the following values:

wxANIMATION_TYPE_GIF | Load an animated GIF file.
wxANIMATION_TYPE_ANI | Load an ANI file.
wxANIMATION_TYPE_ANY | Try to autodetect the filetype.

Return value

`true` if the operation succeeded, `false` otherwise.

### wxAnimation::LoadFile

bool LoadFile(const wxString& name, wxAnimationType type = wxANIMATION_TYPE_ANY)

Loads an animation from a file.

Parameters

name

A filename.

type

One of the following values:

wxANIMATION_TYPE_GIF | Load an animated GIF file.
wxANIMATION_TYPE_ANI | Load an ANI file.
wxANIMATION_TYPE_ANY | Try to autodetect the filetype.

Return value

`true` if the operation succeeded, `false` otherwise.

### wxAnimation::operator =

wxAnimation& operator =(const wxAnimation& brush)

Assignment operator, using reference counting.