Animation View

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Enumerations | Functions
Animation View
Elementary

Animation_View widget is designed to show and play animation of vector graphics based content. More...

## Enumerations
enum | Elm_Animation_View_State { ELM_ANIMATION_VIEW_STATE_NOT_READY = 0 , ELM_ANIMATION_VIEW_STATE_PLAY , ELM_ANIMATION_VIEW_STATE_PLAY_BACK , ELM_ANIMATION_VIEW_STATE_PAUSE , ELM_ANIMATION_VIEW_STATE_STOP }
| Defines the state of animation view. More...

## Functions
void | elm_animation_view_auto_play_set (Elm_Animation_View *obj, Eina_Bool auto_play)
| Animation will be started automatically when it's possible.
Eina_Bool | elm_animation_view_auto_play_get (const Elm_Animation_View *obj)
| Animation will be started automatically when it's possible.
void | elm_animation_view_auto_repeat_set (Elm_Animation_View *obj, Eina_Bool auto_repeat)
| Turn on/off animation looping.
Eina_Bool | elm_animation_view_auto_repeat_get (const Elm_Animation_View *obj)
| Turn on/off animation looping.
Eina_Bool | elm_animation_view_speed_set (Elm_Animation_View *obj, double speed)
| Control animation speed.
double | elm_animation_view_speed_get (const Elm_Animation_View *obj)
| Control animation speed.
double | elm_animation_view_duration_time_get (const Elm_Animation_View *obj)
| Get the duration of animation in seconds.
void | elm_animation_view_progress_set (Elm_Animation_View *obj, double progress)
| Set current progress position of animation view object.
double | elm_animation_view_progress_get (const Elm_Animation_View *obj)
| Set current progress position of animation view object.
void | elm_animation_view_frame_set (Elm_Animation_View *obj, int frame_num)
| Number of current frame.
int | elm_animation_view_frame_get (const Elm_Animation_View *obj)
| Number of current frame.
Eina_Bool | elm_animation_view_play (Elm_Animation_View *obj)
| Play animation one time instantly when it's available.
Eina_Bool | elm_animation_view_play_back (Elm_Animation_View *obj)
| Play back animation one time instantly when it's available.
Eina_Bool | elm_animation_view_pause (Elm_Animation_View *obj)
| Pause current animation instantly.
Eina_Bool | elm_animation_view_resume (Elm_Animation_View *obj)
| Resume paused animation to continue animation.
Eina_Bool | elm_animation_view_stop (Elm_Animation_View *obj)
| Stop playing animation.
Eina_Size2D | elm_animation_view_default_size_get (const Elm_Animation_View *obj)
| Get the default view size that specified from vector resource.
Eina_Bool | elm_animation_view_is_playing_back (Elm_Animation_View *obj)
| Returns the status whether current animation is on playing forward or backward.
int | elm_animation_view_frame_count_get (const Elm_Animation_View *obj)
| Get the index of end frame of the animation view, if it's animated.
void | elm_animation_view_min_progress_set (Elm_Animation_View *obj, double min_progress)
| The start progress of the play.
double | elm_animation_view_min_progress_get (const Elm_Animation_View *obj)
| The start progress of the play.
void | elm_animation_view_max_progress_set (Elm_Animation_View *obj, double max_progress)
| The last progress of the play.
double | elm_animation_view_max_progress_get (const Elm_Animation_View *obj)
| The last progress of the play.
void | elm_animation_view_min_frame_set (Elm_Animation_View *obj, int min_frame)
| The start frame of the play.
int | elm_animation_view_min_frame_get (const Elm_Animation_View *obj)
| The start frame of the play.
void | elm_animation_view_max_frame_set (Elm_Animation_View *obj, int max_frame)
| The last frame of the play.
int | elm_animation_view_max_frame_get (const Elm_Animation_View *obj)
| The last frame of the play.
Elm_Animation_View * | elm_animation_view_add (Evas_Object *parent)
| Add a new animation view widget to the parent's canvas.
Eina_Bool | elm_animation_view_file_set (Elm_Animation_View *obj, const char *file, const char *key)
| Set the source file from where an vector object must fetch the real vector data (it may be one of json, svg, eet files).
Elm_Animation_View_State | elm_animation_view_state_get (Elm_Animation_View *obj)
| Get current animation view state.

## Detailed Description

Animation_View widget is designed to show and play animation of vector graphics based content.

It hides all efl_canvas_vg details but just open an API to read vector data from file. Also, it implements details of animation control methods of Vector.

Vector data could contain static or animatable vector elements including animation infomation. Currently approved vector data file format is svg, json and eet. Only json(known for Lottie file as well) and eet could contains animation infomation, currently Animation_View is supporting.

This widget emits the following signals, besides the ones sent from Animation View.

- "play,start": animation is just started.
- "play,repeat": animation is just repeated.
- "play,done": animation is just finished.
- "play,pause": animation is just paused.
- "play,resume": animation is just resumed.
- "play,stop": animation is just stopped.
- "play,update": animation is updated to the next frame.

## Enumeration Type Documentation

## ◆ Elm_Animation_View_State

enum Elm_Animation_View_State

Defines the state of animation view.

Enumerator
ELM_ANIMATION_VIEW_STATE_NOT_READY | Animation is not ready to play. (Probably, it didn't file set yet or failed to read file. Since 1.23
ELM_ANIMATION_VIEW_STATE_PLAY | Animation is on playing. see elm_animation_view_play Since 1.23
ELM_ANIMATION_VIEW_STATE_PLAY_BACK | Animation is on playing back (rewinding). see elm_animation_view_play_back Since 1.23
ELM_ANIMATION_VIEW_STATE_PAUSE | Animation has been paused. To continue animation, call elm_animation_view_resume. see elm_animation_view_pause Since 1.23
ELM_ANIMATION_VIEW_STATE_STOP | Animation view successfully loaded a file then readied for playing. Otherwise after finished animation or stopped forcely by request. see elm_animation_view_stop Since 1.23

## Function Documentation

## ◆ elm_animation_view_auto_play_set()

void elm_animation_view_auto_play_set | ( | Elm_Animation_View * | obj,
|  | Eina_Bool | auto_play
| ) |  |

Animation will be started automatically when it's possible.

If elm_animation_view_auto_play_get is `true`, animation will be started when it's readied. The condition of `auto` play is when animation view opened file successfully, yet to play it plus when the object is visible. If animation view is disabled, invisible, it turns to pause state then resume animation when it's visible again.

Warning
  This auto play will be only affected to the next animation source. So must be called before setting animation file

Set auto play mode of an animation view object. `true` Enable auto play mode, disable otherwise

Parameters

  [in] | obj | The object.
  [in] | auto_play | Auto play mode, Default value is `false`

Since
  1.23

## ◆ elm_animation_view_auto_play_get()

Eina_Bool elm_animation_view_auto_play_get | ( | const Elm_Animation_View * | obj | ) |

Animation will be started automatically when it's possible.

If elm_animation_view_auto_play_get is `true`, animation will be started when it's readied. The condition of `auto` play is when animation view opened file successfully, yet to play it plus when the object is visible. If animation view is disabled, invisible, it turns to pause state then resume animation when it's visible again.

Warning
  This auto play will be only affected to the next animation source. So must be called before setting animation file

Returns auto play mode of an animation view object.

Parameters

  [in] | obj | The object.

Returns
  Auto play mode, Default value is `false`

Since
  1.23

## ◆ elm_animation_view_auto_repeat_set()

void elm_animation_view_auto_repeat_set | ( | Elm_Animation_View * | obj,
|  | Eina_Bool | auto_repeat
| ) |  |

Turn on/off animation looping.

If elm_animation_view_auto_repeat_get is `true`, it repeats animation when animation frame is reached to end. This auto repeat mode is valid to both play and play_back cases.

Enable loop mode if `true`, disable otherwise.

Parameters

  [in] | obj | The object.
  [in] | auto_repeat | Loop mode, Defalut is `false`.

Since
  1.23

## ◆ elm_animation_view_auto_repeat_get()

Eina_Bool elm_animation_view_auto_repeat_get | ( | const Elm_Animation_View * | obj | ) |

Turn on/off animation looping.

If elm_animation_view_auto_repeat_get is `true`, it repeats animation when animation frame is reached to end. This auto repeat mode is valid to both play and play_back cases.

Returns auto repeat mode of an animation view object.

Parameters

  [in] | obj | The object.

Returns
  Loop mode, Defalut is `false`.

Since
  1.23

## ◆ elm_animation_view_speed_set()

Eina_Bool elm_animation_view_speed_set | ( | Elm_Animation_View * | obj,
|  | double | speed
| ) |  |

Control animation speed.

Control animation speed by multiplying `speed` value. If you want to play animation double-time faster, you can give `speed` 2. If you want to play animation double-time slower, you can give `speed` 0.5.

Warning
  speed must be greater than zero.

Parameters

  [in] | obj | The object.
  [in] | speed | Speed factor. Default value is 1.0

Returns
  `true` when it's successful. `false` otherwise.

Since
  1.23

## ◆ elm_animation_view_speed_get()

double elm_animation_view_speed_get | ( | const Elm_Animation_View * | obj | ) |

Control animation speed.

Control animation speed by multiplying `speed` value. If you want to play animation double-time faster, you can give `speed` 2. If you want to play animation double-time slower, you can give `speed` 0.5.

Warning
  speed must be greater than zero.

Returns current animation speed of an animation view object.

Parameters

  [in] | obj | The object.

Returns
  Speed factor. Default value is 1.0

Since
  1.23

## ◆ elm_animation_view_duration_time_get()

double elm_animation_view_duration_time_get | ( | const Elm_Animation_View * | obj | ) |

Get the duration of animation in seconds.

This API returns total duration time of current animation in the seconds. If current animation source isn't animatable, it returns zero.

Returns current duration of an animation in seconds.

Parameters

  [in] | obj | The object.

Returns
  duration time in the seconds

Since
  1.23

## ◆ elm_animation_view_progress_set()

void elm_animation_view_progress_set | ( | Elm_Animation_View * | obj,
|  | double | progress
| ) |  |

Set current progress position of animation view object.

When you required to jump on a certain frame instantly, you can change current position by using this API.

Warning
  The range of progress is 0 ~ 1.

Set the current progress position of an animation view object.

Parameters

  [in] | obj | The object.
  [in] | progress | Progress position. Value must be 0 ~ 1.

Since
  1.23

## ◆ elm_animation_view_progress_get()

double elm_animation_view_progress_get | ( | const Elm_Animation_View * | obj | ) |

Set current progress position of animation view object.

When you required to jump on a certain frame instantly, you can change current position by using this API.

Warning
  The range of progress is 0 ~ 1.

Returns current progress position of an animation view object.

Parameters

  [in] | obj | The object.

Returns
  Progress position. Value must be 0 ~ 1.

Since
  1.23

## ◆ elm_animation_view_frame_set()

void elm_animation_view_frame_set | ( | Elm_Animation_View * | obj,
|  | int | frame_num
| ) |  |

Number of current frame.

Ranges from 0 to elm_animation_view_frame_count_get - 1.

Set the current frame of an animation view object.

Parameters

  [in] | obj | The object.
  [in] | frame_num | Current frame number.

Since
  1.23

## ◆ elm_animation_view_frame_get()

int elm_animation_view_frame_get | ( | const Elm_Animation_View * | obj | ) |

Number of current frame.

Ranges from 0 to elm_animation_view_frame_count_get - 1.

Returns the current frame of an animation view object.

Parameters

  [in] | obj | The object.

Returns
  Current frame number.

Since
  1.23

## ◆ elm_animation_view_play()

Eina_Bool elm_animation_view_play | ( | Elm_Animation_View * | obj | ) |

Play animation one time instantly when it's available.

If current keyframe is on a certain position by playing back, this will play forward from there.

Warning
  Play request will be ignored if animation source is not set yet or animation is paused state or it's already on playing.

Parameters

  [in] | obj | The object.

Returns
  `true` when it's successful. `false` otherwise.

Since
  1.23

## ◆ elm_animation_view_play_back()

Eina_Bool elm_animation_view_play_back | ( | Elm_Animation_View * | obj | ) |

Play back animation one time instantly when it's available.

If current keyframe is on a certain position by playing, this will play backward from there.

Warning
  Play back request will be ignored if animation source is not set yet or animation is paused state or it's already on playing back.

Parameters

  [in] | obj | The object.

Returns
  `true` when it's successful. `false` otherwise.

Since
  1.23

## ◆ elm_animation_view_pause()

Eina_Bool elm_animation_view_pause | ( | Elm_Animation_View * | obj | ) |

Pause current animation instantly.

Once animation is paused, animation view must get resume to play continue again.

Warning
  Animation must be on playing or playing back status.

Parameters

  [in] | obj | The object.

Returns
  `true` when it's successful. `false` otherwise.

Since
  1.23

## ◆ elm_animation_view_resume()

Eina_Bool elm_animation_view_resume | ( | Elm_Animation_View * | obj | ) |

Resume paused animation to continue animation.

Warning
  This resume must be called on animation paused status.

Parameters

  [in] | obj | The object.

Returns
  `true` when it's successful. `false` otherwise.

Since
  1.23

## ◆ elm_animation_view_stop()

Eina_Bool elm_animation_view_stop | ( | Elm_Animation_View * | obj | ) |

Stop playing animation.

Stop animation instatly regardless of it's status and reset to show first frame of animation. Even though current animation is paused, the animation status will be stopped.

Parameters

  [in] | obj | The object.

Returns
  `true` when it's successful. `false` otherwise.

Since
  1.23

## ◆ elm_animation_view_default_size_get()

Eina_Size2D elm_animation_view_default_size_get | ( | const Elm_Animation_View * | obj | ) |

Get the default view size that specified from vector resource.

Since
  1.23

## ◆ elm_animation_view_is_playing_back()

Eina_Bool elm_animation_view_is_playing_back | ( | Elm_Animation_View * | obj | ) |

Returns the status whether current animation is on playing forward or backward.

warning: If animation view is not on playing, it will return `false`.

Parameters

  [in] | obj | The object.

Returns
  `true`, if animation on playing back, `false` otherwise.

Since
  1.23

## ◆ elm_animation_view_frame_count_get()

int elm_animation_view_frame_count_get | ( | const Elm_Animation_View * | obj | ) |

Get the index of end frame of the animation view, if it's animated.

note : frame number starts with 0.

Parameters

  [in] | obj | The object.

Returns
  The number of frames. 0, if it's not animated.

Since
  1.23

## ◆ elm_animation_view_min_progress_set()

void elm_animation_view_min_progress_set | ( | Elm_Animation_View * | obj,
|  | double | min_progress
| ) |  |

The start progress of the play.

Default value is 0.

Set start progress of an animation object.

Parameters

  [in] | obj | The object.
  [in] | min_progress | The minimum progress. Value must be 0 ~ 1.

Since
  1.23

## ◆ elm_animation_view_min_progress_get()

double elm_animation_view_min_progress_get | ( | const Elm_Animation_View * | obj | ) |

The start progress of the play.

Default value is 0.

Returns start progress of an animation object.

Parameters

  [in] | obj | The object.

Returns
  The minimum progress. Value must be 0 ~ 1.

Since
  1.23

## ◆ elm_animation_view_max_progress_set()

void elm_animation_view_max_progress_set | ( | Elm_Animation_View * | obj,
|  | double | max_progress
| ) |  |

The last progress of the play.

Default value is 1.

Set last progress of an animation object.

Parameters

  [in] | obj | The object.
  [in] | max_progress | The maximum progress. Value must be 0 ~ 1.

Since
  1.23

## ◆ elm_animation_view_max_progress_get()

double elm_animation_view_max_progress_get | ( | const Elm_Animation_View * | obj | ) |

The last progress of the play.

Default value is 1.

Returns last progress of an animation object.

Parameters

  [in] | obj | The object.

Returns
  The maximum progress. Value must be 0 ~ 1.

Since
  1.23

## ◆ elm_animation_view_min_frame_set()

void elm_animation_view_min_frame_set | ( | Elm_Animation_View * | obj,
|  | int | min_frame
| ) |  |

The start frame of the play.

Default value is 0.

Set minimum frame of an animation object.

Parameters

  [in] | obj | The object.
  [in] | min_frame | The minimum frame for play. Value must be 0 ~ elm_animation_view_max_frame_get

Since
  1.23

## ◆ elm_animation_view_min_frame_get()

int elm_animation_view_min_frame_get | ( | const Elm_Animation_View * | obj | ) |

The start frame of the play.

Default value is 0.

Returns minimum frame of an animation object.

Parameters

  [in] | obj | The object.

Returns
  The minimum frame for play. Value must be 0 ~ elm_animation_view_max_frame_get

Since
  1.23

## ◆ elm_animation_view_max_frame_set()

void elm_animation_view_max_frame_set | ( | Elm_Animation_View * | obj,
|  | int | max_frame
| ) |  |

The last frame of the play.

Default value is elm_animation_view_frame_count_get - 1

Set maximum frame of an animation object.

Parameters

  [in] | obj | The object.
  [in] | max_frame | The maximum frame for play. Value must be elm_animation_view_min_frame_get ~ (elm_animation_view_frame_count_get - 1)

Since
  1.23

## ◆ elm_animation_view_max_frame_get()

int elm_animation_view_max_frame_get | ( | const Elm_Animation_View * | obj | ) |

The last frame of the play.

Default value is elm_animation_view_frame_count_get - 1

Returns maximum frame of an animation object.

Parameters

  [in] | obj | The object.

Returns
  The maximum frame for play. Value must be elm_animation_view_min_frame_get ~ (elm_animation_view_frame_count_get - 1)

Since
  1.23

## ◆ elm_animation_view_add()

Elm_Animation_View * elm_animation_view_add | ( | Evas_Object * | parent | ) |

Add a new animation view widget to the parent's canvas.

Parameters

  parent | The parent object

Returns
  The new animation view object or `NULL` if it failed to create.

Since
  1.23

References EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ elm_animation_view_file_set()

Eina_Bool elm_animation_view_file_set | ( | Elm_Animation_View * | obj,
|  | const char * | file,
|  | const char * | key
| ) |  |

Set the source file from where an vector object must fetch the real vector data (it may be one of json, svg, eet files).

If the file supports multiple data stored in it (as Eet files do), you can specify the key to be used as the index of the vector in this file.

Parameters

  [in] | file | The vector file path.
  [in] | key | The vector key in `file` (if its an Eet one), or `NULL`, otherwise.

Returns
  `EINA_TRUE` if it's succeed to read file, `EINA_FALSE` otherwise.

Since
  1.23

## ◆ elm_animation_view_state_get()

Elm_Animation_View_State elm_animation_view_state_get | ( | Elm_Animation_View * | obj | ) |

Get current animation view state.

Returns
  Current animation view state

See also
  Elm_Animation_View_State

Since
  1.23

References ELM_ANIMATION_VIEW_STATE_NOT_READY, ELM_ANIMATION_VIEW_STATE_PAUSE, ELM_ANIMATION_VIEW_STATE_PLAY, ELM_ANIMATION_VIEW_STATE_PLAY_BACK, and ELM_ANIMATION_VIEW_STATE_STOP.