wxRuby Documentation Home

# Wx::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 Animation. To display an animation on screen,
use AnimationCtrl

## Derived from

GDIObject

Object

## Predefined objects

Wx::NULL_ANIMATION

## See also

AnimationCtrl

## Methods

- Animation.new
- Animation#get_delay
- Animation#get_frame_count
- Animation#get_frame
- Animation#get_size
- Animation#is_ok
- Animation#load
- Animation#load_file

### Animation.new

Animation.new(%(arg-type)Animation% anim)

Copy constructor, uses reference counting.

Animation.new(%(arg-type)String% name, AnimationType type = ANIMATION_TYPE_ANY)

Loads an animation from a file.

- name The name of the file to load.
- type See load_file for more info.

### Animation#get_delay

Integer get_delay(%(arg-type)unsigned int% i)

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

### Animation#get_frame_count

unsigned int get_frame_count()

Returns the number of frames for this animation.

### Animation#get_frame

Image get_frame(%(arg-type)unsigned int% i)

Returns the i-th frame as a Image.

### Animation#get_size

Size get_size()

Returns the size of the animation.

### Animation#is_ok

Boolean is_ok()

Returns if animation data is present.

### Animation#load

Boolean load(%(arg-type)InputStream% stream, AnimationType type = ANIMATION_TYPE_ANY)

Loads an animation from the given stream. This is not currently
supported in wxRuby.

#### Parameters

- stream The stream to use to load the animation.
- type One of the following values:

ANIMATION_TYPE_GIF | Load an animated GIF file.
ANIMATION_TYPE_ANI | Load an ANI file.
ANIMATION_TYPE_ANY | Try to autodetect the filetype.

#### Return value

if the operation succeeded, otherwise.

### Animation#load_file

Boolean load_file(%(arg-type)String% name, AnimationType type = ANIMATION_TYPE_ANY)

Loads an animation from a file.

#### Parameters

- name A filename.
- type One of the following values:

ANIMATION_TYPE_GIF | Load an animated GIF file.
ANIMATION_TYPE_ANI | Load an ANI file.
ANIMATION_TYPE_ANY | Try to autodetect the filetype.

#### Return value

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

[This page automatically generated from the Textile source at 2023-06-09 00:45:31 +0000]