Efl.Ui.Animation_View: Implement sector playing feature

Summary:
play_sector method is API for playing section.
If the animation object has section information, user can play the section.
Get the start and end section name and get the frame of each section.
And set and play the min and max frames of the current animation object.

Depends on D10506

Test Plan:
For example. Animation objects have "first","second" and "third" sectors.
And sector "second" has duration information.

User can use it like this:
efl_ui_animation_view_play_sector(anim_view, "first", "second");
efl_ui_animation_view_play_sector(anim_view, "second", NULL);
efl_ui_animation_view_play_sector(anim_view, "first", NULL); // first sector ~ end frame of animation object.
efl_ui_animation_view_play_sector(anim_view, "second", "third");
efl_ui_animation_view_play_sector(anim_view, "second", "wrong name");

Reviewers: Hermet, smohanty, kimcinoo

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10507
This commit is contained in:
junsu choi 2019-11-12 14:30:25 +09:00
parent bcfffc07cf
commit 7d97abc05b
2 changed files with 50 additions and 0 deletions

View File

@ -468,6 +468,37 @@ _efl_ui_animation_view_play(Eo *obj, Efl_Ui_Animation_View_Data *pd)
return EINA_TRUE;
}
Eina_Bool _efl_ui_animation_view_play_sector(Eo *obj, Efl_Ui_Animation_View_Data *pd, const char *start, const char *end)
{
int start_frame = 0;
int end_frame = evas_object_vg_animated_frame_count_get(pd->vg) - 1;
if (start && end)
{
efl_gfx_frame_controller_sector_get(pd->vg, start, &start_frame, NULL);
efl_gfx_frame_controller_sector_get(pd->vg, end, &end_frame, NULL);
}
else
{
if (start)
{
efl_gfx_frame_controller_sector_get(pd->vg, start, &start_frame, &end_frame);
}
else if (end)
{
efl_gfx_frame_controller_sector_get(pd->vg, end, &end_frame, NULL);
}
}
efl_ui_animation_view_min_frame_set(obj, start_frame);
if (start_frame < end_frame)
efl_ui_animation_view_max_frame_set(obj, end_frame);
if (!efl_ui_animation_view_play(obj))
return EINA_FALSE;
return EINA_TRUE;
}
EOLIAN static Eina_Bool
_efl_ui_animation_view_stop(Eo *obj, Efl_Ui_Animation_View_Data *pd)
{

View File

@ -135,6 +135,25 @@ class @beta Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View,
return: bool; [[$true when it's successful. $false otherwise.]]
}
play_sector {
[[Play animation of sector one time instantly when it's available.
If end sector is NULL, only start sector is referenced.
If both the start and end sectors are valid,
Play is played and stoped at starting point of each sector.
If start is null and end is valid, playback starts from 0 frame to the start frame of the end sector.
If both sectors start and end are invalid. Play from 0 frame to the last frame of animation view object.
Note: This method use to @.min_frame, @.max_frame (@.min_progress, @.max_progress) internally.
So if you have changed the min or max frame(progress) it can be changed to the sector frame.
]]
params {
@in start: string; [[ The name of start sector ]]
@in end: string; [[ The name of end sector ]]
}
return: bool; [[$true when it's successful. $false otherwise.]]
}
play_back {
[[Play back animation one time instantly when it's available.