forked from enlightenment/efl
efl_playable: split Efl.Player interface to Efl.Playable interface
Summary: Efl.Player interface simply provides play functions, but another interface which indicates Efl.Player will play is also needed. Test Plan: Run elementary_test->Efl.Animation tests Reviewers: woohyun, conr2d, Jaehyun_Cho, jpeg, cedric Differential Revision: https://phab.enlightenment.org/D5662
This commit is contained in:
parent
1da72770f3
commit
588995da31
|
@ -24,6 +24,7 @@ efl_eolian_files = \
|
|||
lib/efl/interfaces/efl_file.eo \
|
||||
lib/efl/interfaces/efl_image_load.eo \
|
||||
lib/efl/interfaces/efl_part.eo \
|
||||
lib/efl/interfaces/efl_playable.eo \
|
||||
lib/efl/interfaces/efl_player.eo \
|
||||
lib/efl/interfaces/efl_text.eo \
|
||||
lib/efl/interfaces/efl_text_font.eo \
|
||||
|
|
|
@ -50,14 +50,7 @@ evas_canvas_eolian_pub_files = \
|
|||
lib/evas/canvas/efl_animation_group.eo \
|
||||
lib/evas/canvas/efl_animation_group_parallel.eo \
|
||||
lib/evas/canvas/efl_animation_group_sequential.eo \
|
||||
lib/evas/canvas/efl_animation_object.eo \
|
||||
lib/evas/canvas/efl_animation_object_alpha.eo \
|
||||
lib/evas/canvas/efl_animation_object_rotate.eo \
|
||||
lib/evas/canvas/efl_animation_object_scale.eo \
|
||||
lib/evas/canvas/efl_animation_object_translate.eo \
|
||||
lib/evas/canvas/efl_animation_object_group.eo \
|
||||
lib/evas/canvas/efl_animation_object_group_parallel.eo \
|
||||
lib/evas/canvas/efl_animation_object_group_sequential.eo \
|
||||
lib/evas/canvas/efl_animation_player.eo \
|
||||
$(NULL)
|
||||
|
||||
evas_gesture_eolian_pub_files = \
|
||||
|
@ -186,14 +179,7 @@ lib/evas/canvas/efl_animation_translate_private.h \
|
|||
lib/evas/canvas/efl_animation_group_private.h \
|
||||
lib/evas/canvas/efl_animation_group_parallel_private.h \
|
||||
lib/evas/canvas/efl_animation_group_sequential_private.h \
|
||||
lib/evas/canvas/efl_animation_object_private.h \
|
||||
lib/evas/canvas/efl_animation_object_alpha_private.h \
|
||||
lib/evas/canvas/efl_animation_object_rotate_private.h \
|
||||
lib/evas/canvas/efl_animation_object_scale_private.h \
|
||||
lib/evas/canvas/efl_animation_object_translate_private.h \
|
||||
lib/evas/canvas/efl_animation_object_group_private.h \
|
||||
lib/evas/canvas/efl_animation_object_group_parallel_private.h \
|
||||
lib/evas/canvas/efl_animation_object_group_sequential_private.h \
|
||||
lib/evas/canvas/efl_animation_player_private.h \
|
||||
lib/evas/gesture/efl_gesture_private.h
|
||||
|
||||
# Linebreak
|
||||
|
@ -288,14 +274,7 @@ lib/evas/canvas/efl_animation_translate.c \
|
|||
lib/evas/canvas/efl_animation_group.c \
|
||||
lib/evas/canvas/efl_animation_group_parallel.c \
|
||||
lib/evas/canvas/efl_animation_group_sequential.c \
|
||||
lib/evas/canvas/efl_animation_object.c \
|
||||
lib/evas/canvas/efl_animation_object_alpha.c \
|
||||
lib/evas/canvas/efl_animation_object_rotate.c \
|
||||
lib/evas/canvas/efl_animation_object_scale.c \
|
||||
lib/evas/canvas/efl_animation_object_translate.c \
|
||||
lib/evas/canvas/efl_animation_object_group.c \
|
||||
lib/evas/canvas/efl_animation_object_group_parallel.c \
|
||||
lib/evas/canvas/efl_animation_object_group_sequential.c \
|
||||
lib/evas/canvas/efl_animation_player.c \
|
||||
lib/evas/gesture/efl_gesture_touch.c \
|
||||
lib/evas/gesture/efl_gesture.c \
|
||||
lib/evas/gesture/efl_gesture_tap.c \
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _App_Data
|
|||
{
|
||||
Efl_Animation *show_anim;
|
||||
Efl_Animation *hide_anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
Efl_Animation_Player *anim_obj;
|
||||
|
||||
Eina_Bool is_btn_visible;
|
||||
} App_Data;
|
||||
|
@ -19,19 +19,15 @@ _anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
printf("Animation has been ended!\n");
|
||||
|
||||
ad->anim_obj = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -41,35 +37,23 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
if (ad->anim_obj)
|
||||
efl_animation_object_cancel(ad->anim_obj);
|
||||
|
||||
ad->is_btn_visible = !(ad->is_btn_visible);
|
||||
|
||||
if (ad->is_btn_visible)
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->show_anim);
|
||||
elm_object_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->show_anim);
|
||||
efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->hide_anim);
|
||||
elm_object_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->hide_anim);
|
||||
efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
|
||||
}
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(ad->anim_obj);
|
||||
efl_player_start(ad->anim_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -99,23 +83,29 @@ test_efl_anim_alpha(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
|
|||
evas_object_show(btn);
|
||||
|
||||
//Show Animation
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(show_anim, 0.0, 1.0);
|
||||
efl_animation_duration_set(show_anim, 1.0);
|
||||
efl_animation_target_set(show_anim, btn);
|
||||
efl_animation_final_state_keep_set(show_anim, EINA_TRUE);
|
||||
|
||||
//Hide Animation
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(hide_anim, 1.0, 0.0);
|
||||
efl_animation_duration_set(hide_anim, 1.0);
|
||||
efl_animation_target_set(hide_anim, btn);
|
||||
efl_animation_final_state_keep_set(hide_anim, EINA_TRUE);
|
||||
|
||||
//Initialize App Data
|
||||
ad->show_anim = show_anim;
|
||||
ad->hide_anim = hide_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
ad->is_btn_visible = EINA_TRUE;
|
||||
|
||||
//Button to start animation
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
typedef struct _App_Data
|
||||
{
|
||||
Efl_Animation_Object *target;
|
||||
Efl_Animation_Player *target;
|
||||
|
||||
Eina_Bool is_btn_visible;
|
||||
} App_Data;
|
||||
|
@ -57,20 +57,20 @@ test_efl_anim_event_anim(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
|
|||
evas_object_move(btn, 100, 50);
|
||||
|
||||
//Show Animation
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(show_anim, 0.0, 1.0);
|
||||
efl_animation_duration_set(show_anim, 1.0);
|
||||
efl_animation_target_set(show_anim, btn);
|
||||
efl_animation_final_state_keep_set(show_anim, EINA_TRUE);
|
||||
efl_canvas_object_event_animation_set(btn, EFL_GFX_EVENT_SHOW, show_anim);
|
||||
|
||||
//Show button after setting event animation to show animation for show event
|
||||
evas_object_show(btn);
|
||||
|
||||
//Hide Animation
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(hide_anim, 1.0, 0.0);
|
||||
efl_animation_duration_set(hide_anim, 1.0);
|
||||
efl_animation_target_set(hide_anim, btn);
|
||||
efl_animation_final_state_keep_set(hide_anim, EINA_TRUE);
|
||||
efl_canvas_object_event_animation_set(btn, EFL_GFX_EVENT_HIDE, hide_anim);
|
||||
|
||||
//Initialize App Data
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _App_Data
|
|||
{
|
||||
Efl_Animation *parallel_show_anim;
|
||||
Efl_Animation *parallel_hide_anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
Efl_Animation_Player *anim_obj;
|
||||
|
||||
Eina_Bool is_btn_visible;
|
||||
} App_Data;
|
||||
|
@ -19,19 +19,16 @@ _anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
printf("Animation has been ended!\n");
|
||||
|
||||
ad->anim_obj = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -41,35 +38,23 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
if (ad->anim_obj)
|
||||
efl_animation_object_cancel(ad->anim_obj);
|
||||
|
||||
ad->is_btn_visible = !(ad->is_btn_visible);
|
||||
|
||||
if (ad->is_btn_visible)
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->parallel_show_anim);
|
||||
elm_object_text_set(obj, "Start Parallel Group Animation to hide button");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->parallel_show_anim);
|
||||
efl_text_set(obj, "Start Parallel Group Animation to hide button");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->parallel_hide_anim);
|
||||
elm_object_text_set(obj, "Start Parallel Group Animation to show button");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->parallel_hide_anim);
|
||||
efl_text_set(obj, "Start Parallel Group Animation to show button");
|
||||
}
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(ad->anim_obj);
|
||||
efl_player_start(ad->anim_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -100,21 +85,20 @@ test_efl_anim_group_parallel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
|
|||
|
||||
|
||||
//Show Animation
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(show_anim, 0.0, 1.0);
|
||||
|
||||
//Rotate from 45 to 0 degrees Animation
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_set(ccw_45_degrees_anim, 45.0, 0.0, NULL, 0.5, 0.5);
|
||||
|
||||
//Scale Animation to zoom out
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, NULL, 0.5, 0.5);
|
||||
|
||||
//Show Parallel Group Animation
|
||||
Efl_Animation *parallel_show_anim = efl_add(EFL_ANIMATION_GROUP_PARALLEL_CLASS, NULL);
|
||||
Efl_Animation *parallel_show_anim = efl_add(EFL_ANIMATION_GROUP_PARALLEL_CLASS, win);
|
||||
efl_animation_duration_set(parallel_show_anim, 1.0);
|
||||
efl_animation_target_set(parallel_show_anim, btn);
|
||||
efl_animation_final_state_keep_set(parallel_show_anim, EINA_TRUE);
|
||||
|
||||
//Add animations to group animation
|
||||
|
@ -124,21 +108,20 @@ test_efl_anim_group_parallel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
|
|||
|
||||
|
||||
//Hide Animation
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(hide_anim, 1.0, 0.0);
|
||||
|
||||
//Rotate from 0 to 45 degrees Animation
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_set(cw_45_degrees_anim, 0.0, 45.0, NULL, 0.5, 0.5);
|
||||
|
||||
//Scale Animation to zoom in
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, NULL, 0.5, 0.5);
|
||||
|
||||
//Hide Parallel Group Animation
|
||||
Efl_Animation *parallel_hide_anim = efl_add(EFL_ANIMATION_GROUP_PARALLEL_CLASS, NULL);
|
||||
Efl_Animation *parallel_hide_anim = efl_add(EFL_ANIMATION_GROUP_PARALLEL_CLASS, win);
|
||||
efl_animation_duration_set(parallel_hide_anim, 1.0);
|
||||
efl_animation_target_set(parallel_hide_anim, btn);
|
||||
efl_animation_final_state_keep_set(parallel_hide_anim, EINA_TRUE);
|
||||
|
||||
//Add animations to group animation
|
||||
|
@ -150,7 +133,16 @@ test_efl_anim_group_parallel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
|
|||
//Initialize App Data
|
||||
ad->parallel_show_anim = parallel_show_anim;
|
||||
ad->parallel_hide_anim = parallel_hide_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->is_btn_visible = EINA_TRUE;
|
||||
|
||||
//Button to start animation
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _App_Data
|
|||
{
|
||||
Efl_Animation *sequential_show_anim;
|
||||
Efl_Animation *sequential_hide_anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
Efl_Animation_Player *anim_obj;
|
||||
|
||||
Eina_Bool is_btn_visible;
|
||||
} App_Data;
|
||||
|
@ -19,19 +19,15 @@ _anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
printf("Animation has been ended!\n");
|
||||
|
||||
ad->anim_obj = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -41,35 +37,23 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
if (ad->anim_obj)
|
||||
efl_animation_object_cancel(ad->anim_obj);
|
||||
|
||||
ad->is_btn_visible = !(ad->is_btn_visible);
|
||||
|
||||
if (ad->is_btn_visible)
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->sequential_show_anim);
|
||||
elm_object_text_set(obj, "Start Sequential Group Animation to hide button");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->sequential_show_anim);
|
||||
efl_text_set(obj, "Start Sequential Group Animation to hide button");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->sequential_hide_anim);
|
||||
elm_object_text_set(obj, "Start Sequential Group Animation to show button");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->sequential_hide_anim);
|
||||
efl_text_set(obj, "Start Sequential Group Animation to show button");
|
||||
}
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(ad->anim_obj);
|
||||
efl_player_start(ad->anim_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -101,21 +85,20 @@ test_efl_anim_group_sequential(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
|
|||
|
||||
/* Animations to hide button */
|
||||
//Rotate from 0 to 45 degrees Animation
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_set(cw_45_degrees_anim, 0.0, 45.0, NULL, 0.5, 0.5);
|
||||
|
||||
//Scale Animation to zoom in
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, NULL, 0.5, 0.5);
|
||||
|
||||
//Hide Animation
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(hide_anim, 1.0, 0.0);
|
||||
|
||||
//Hide Sequential Group Animation
|
||||
Efl_Animation *sequential_hide_anim = efl_add(EFL_ANIMATION_GROUP_SEQUENTIAL_CLASS, NULL);
|
||||
Efl_Animation *sequential_hide_anim = efl_add(EFL_ANIMATION_GROUP_SEQUENTIAL_CLASS, win);
|
||||
efl_animation_duration_set(sequential_hide_anim, 1.0);
|
||||
efl_animation_target_set(sequential_hide_anim, btn);
|
||||
efl_animation_final_state_keep_set(sequential_hide_anim, EINA_TRUE);
|
||||
|
||||
//Add animations to group animation
|
||||
|
@ -124,51 +107,29 @@ test_efl_anim_group_sequential(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
|
|||
efl_animation_group_animation_add(sequential_hide_anim, hide_anim);
|
||||
|
||||
|
||||
/* Animations of initial state to show button */
|
||||
//Rotate from 0 to 45 degrees Animation
|
||||
Efl_Animation *cw_45_degrees_anim2 = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
efl_animation_rotate_set(cw_45_degrees_anim2, 0.0, 45.0, NULL, 0.5, 0.5);
|
||||
|
||||
//Scale Animation to zoom in
|
||||
Efl_Animation *scale_double_anim2 = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
efl_animation_scale_set(scale_double_anim2, 1.0, 1.0, 2.0, 2.0, NULL, 0.5, 0.5);
|
||||
|
||||
//Hide Parallel Group Animation
|
||||
Efl_Animation *parallel_hide_anim = efl_add(EFL_ANIMATION_GROUP_PARALLEL_CLASS, NULL);
|
||||
efl_animation_duration_set(parallel_hide_anim, 0.0);
|
||||
efl_animation_target_set(parallel_hide_anim, btn);
|
||||
efl_animation_final_state_keep_set(parallel_hide_anim, EINA_TRUE);
|
||||
|
||||
//Add animations to group animation
|
||||
efl_animation_group_animation_add(parallel_hide_anim, cw_45_degrees_anim2);
|
||||
efl_animation_group_animation_add(parallel_hide_anim, scale_double_anim2);
|
||||
|
||||
|
||||
/* Animations to show button */
|
||||
//Show Animation
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(show_anim, 0.0, 1.0);
|
||||
efl_animation_duration_set(show_anim, 1.0);
|
||||
|
||||
//Scale Animation to zoom out
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
efl_animation_scale_set(scale_half_anim, 1.0, 1.0, 0.5, 0.5, NULL, 0.5, 0.5);
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, NULL, 0.5, 0.5);
|
||||
efl_animation_duration_set(scale_half_anim, 1.0);
|
||||
|
||||
//Rotate from 45 to 0 degrees Animation
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
efl_animation_rotate_set(ccw_45_degrees_anim, 0.0, -45.0, NULL, 0.5, 0.5);
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_set(ccw_45_degrees_anim, 45.0, 0.0, NULL, 0.5, 0.5);
|
||||
efl_animation_duration_set(ccw_45_degrees_anim, 1.0);
|
||||
|
||||
//Show Sequential Group Animation
|
||||
Efl_Animation *sequential_show_anim = efl_add(EFL_ANIMATION_GROUP_SEQUENTIAL_CLASS, NULL);
|
||||
efl_animation_target_set(sequential_show_anim, btn);
|
||||
Efl_Animation *sequential_show_anim = efl_add(EFL_ANIMATION_GROUP_SEQUENTIAL_CLASS, win);
|
||||
efl_animation_final_state_keep_set(sequential_show_anim, EINA_TRUE);
|
||||
//efl_animation_duration_set() is called for each animation not to set the same duration
|
||||
|
||||
//Add animations to group animation
|
||||
//First, parallel_hide_anim is added with duration 0 to set the initial state
|
||||
efl_animation_group_animation_add(sequential_show_anim, parallel_hide_anim);
|
||||
efl_animation_group_animation_add(sequential_show_anim, show_anim);
|
||||
efl_animation_group_animation_add(sequential_show_anim, scale_half_anim);
|
||||
efl_animation_group_animation_add(sequential_show_anim, ccw_45_degrees_anim);
|
||||
|
@ -177,7 +138,16 @@ test_efl_anim_group_sequential(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
|
|||
//Initialize App Data
|
||||
ad->sequential_show_anim = sequential_show_anim;
|
||||
ad->sequential_hide_anim = sequential_hide_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->is_btn_visible = EINA_TRUE;
|
||||
|
||||
//Button to start animation
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
typedef struct _App_Data
|
||||
{
|
||||
Efl_Animation *anim[INTERP_NUM];
|
||||
Efl_Animation_Object *anim_obj[INTERP_NUM];
|
||||
Efl_Animation_Player *anim_obj[INTERP_NUM];
|
||||
|
||||
Evas_Object *btn[INTERP_NUM];
|
||||
Evas_Object *start_all_btn;
|
||||
|
@ -88,7 +88,6 @@ _anim_ended_cb(void *data, const Efl_Event *event)
|
|||
{
|
||||
if (ad->anim_obj[i] == event->object)
|
||||
{
|
||||
ad->anim_obj[i] = NULL;
|
||||
elm_object_disabled_set(ad->btn[i], EINA_FALSE);
|
||||
break;
|
||||
}
|
||||
|
@ -101,7 +100,7 @@ _anim_ended_cb(void *data, const Efl_Event *event)
|
|||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -113,21 +112,8 @@ _anim_start(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
|
||||
int index = (uintptr_t)evas_object_data_get(obj, "index");
|
||||
|
||||
//Create Animation Object from Animation
|
||||
Efl_Animation_Object *anim_obj = efl_animation_object_create(ad->anim[index]);
|
||||
ad->anim_obj[index] = anim_obj;
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, ad);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(anim_obj);
|
||||
efl_player_start(ad->anim_obj[index]);
|
||||
|
||||
elm_object_disabled_set(obj, EINA_TRUE);
|
||||
elm_object_disabled_set(ad->start_all_btn, EINA_TRUE);
|
||||
|
@ -141,22 +127,8 @@ _anim_start_all(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
int i;
|
||||
for (i = 0; i < INTERP_NUM; i++)
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
Efl_Animation_Object *anim_obj = efl_animation_object_create(ad->anim[i]);
|
||||
ad->anim_obj[i] = anim_obj;
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, ad);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(anim_obj);
|
||||
|
||||
efl_player_start(ad->anim_obj[i]);
|
||||
elm_object_disabled_set(ad->btn[i], EINA_TRUE);
|
||||
}
|
||||
|
||||
|
@ -212,14 +184,29 @@ test_efl_anim_interpolator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
evas_object_smart_callback_add(btn, "clicked", _anim_start, ad);
|
||||
ad->btn[i] = btn;
|
||||
|
||||
Efl_Animation *anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, NULL);
|
||||
Efl_Animation *anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_set(anim, 0, 0, (WIN_W - BTN_W), 0);
|
||||
efl_animation_duration_set(anim, 2.0);
|
||||
efl_animation_target_set(anim, btn);
|
||||
efl_animation_final_state_keep_set(anim, EINA_FALSE);
|
||||
|
||||
Efl_Interpolator *interp = _interpolator_create(i);
|
||||
efl_animation_interpolator_set(anim, interp);
|
||||
ad->anim[i] = anim;
|
||||
|
||||
//Create Animation Object from Animation
|
||||
Efl_Animation_Player *anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, NULL,
|
||||
efl_animation_player_animation_set(efl_added, anim),
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
ad->anim_obj[i] = anim_obj;
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, ad);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
}
|
||||
|
||||
ad->running_anim_cnt = 0;
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _App_Data
|
|||
{
|
||||
Efl_Animation *show_anim;
|
||||
Efl_Animation *hide_anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
Efl_Animation_Player *anim_obj;
|
||||
|
||||
Evas_Object *pause_btn;
|
||||
|
||||
|
@ -33,14 +33,12 @@ _anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
|||
printf("Animation has been ended!\n");
|
||||
|
||||
elm_object_disabled_set(ad->pause_btn, EINA_TRUE);
|
||||
|
||||
ad->anim_obj = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -54,8 +52,6 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
|||
{
|
||||
ad->is_anim_paused = EINA_FALSE;
|
||||
elm_object_text_set(ad->pause_btn, "Pause Animation");
|
||||
|
||||
efl_animation_object_cancel(ad->anim_obj);
|
||||
}
|
||||
|
||||
ad->is_btn_visible = !(ad->is_btn_visible);
|
||||
|
@ -63,27 +59,17 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
|||
if (ad->is_btn_visible)
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->show_anim);
|
||||
elm_object_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->show_anim);
|
||||
efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->hide_anim);
|
||||
elm_object_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->hide_anim);
|
||||
efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
|
||||
}
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, ad);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(ad->anim_obj);
|
||||
efl_player_start(ad->anim_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -96,13 +82,13 @@ _pause_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
|||
if (ad->is_anim_paused)
|
||||
{
|
||||
//Pause animation
|
||||
efl_animation_object_pause(ad->anim_obj);
|
||||
efl_player_play_set(ad->anim_obj, EINA_FALSE);
|
||||
elm_object_text_set(obj, "Resume Animation");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Resume animation
|
||||
efl_animation_object_resume(ad->anim_obj);
|
||||
efl_player_play_set(ad->anim_obj, EINA_TRUE);
|
||||
elm_object_text_set(obj, "Pause Animation");
|
||||
}
|
||||
}
|
||||
|
@ -134,17 +120,15 @@ test_efl_anim_pause(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
|
|||
evas_object_show(btn);
|
||||
|
||||
//Show Animation
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(show_anim, 0.0, 1.0);
|
||||
efl_animation_duration_set(show_anim, 2.0);
|
||||
efl_animation_target_set(show_anim, btn);
|
||||
efl_animation_final_state_keep_set(show_anim, EINA_TRUE);
|
||||
|
||||
//Hide Animation
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(hide_anim, 1.0, 0.0);
|
||||
efl_animation_duration_set(hide_anim, 2.0);
|
||||
efl_animation_target_set(hide_anim, btn);
|
||||
efl_animation_final_state_keep_set(hide_anim, EINA_TRUE);
|
||||
|
||||
|
||||
|
@ -172,7 +156,16 @@ test_efl_anim_pause(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
|
|||
//Initialize App Data
|
||||
ad->show_anim = show_anim;
|
||||
ad->hide_anim = hide_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, ad);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->pause_btn = pause_btn;
|
||||
ad->is_btn_visible = EINA_TRUE;
|
||||
ad->is_anim_paused = EINA_FALSE;
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _App_Data
|
|||
{
|
||||
Efl_Animation *show_anim;
|
||||
Efl_Animation *hide_anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
Efl_Animation_Player *anim_obj;
|
||||
|
||||
Evas_Object *start_btn;
|
||||
Evas_Object *repeat_count_spin;
|
||||
|
@ -57,14 +57,12 @@ _anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
|||
|
||||
elm_object_disabled_set(ad->repeat_count_spin, EINA_FALSE);
|
||||
elm_object_disabled_set(ad->repeat_mode_spin, EINA_FALSE);
|
||||
|
||||
ad->anim_obj = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -74,9 +72,6 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
|||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
if (ad->anim_obj)
|
||||
efl_animation_object_cancel(ad->anim_obj);
|
||||
|
||||
ad->is_btn_visible = !(ad->is_btn_visible);
|
||||
|
||||
int repeat_count = elm_spinner_value_get(ad->repeat_count_spin);
|
||||
|
@ -94,8 +89,8 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
|||
efl_animation_repeat_mode_set(ad->show_anim, repeat_mode);
|
||||
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->show_anim);
|
||||
elm_object_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->show_anim);
|
||||
efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -106,21 +101,12 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
|||
efl_animation_repeat_mode_set(ad->hide_anim, repeat_mode);
|
||||
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->hide_anim);
|
||||
elm_object_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->hide_anim);
|
||||
efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
|
||||
}
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(ad->anim_obj);
|
||||
efl_player_start(ad->anim_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -150,17 +136,15 @@ test_efl_anim_repeat(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
evas_object_show(btn);
|
||||
|
||||
//Show Animation
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(show_anim, 0.0, 1.0);
|
||||
efl_animation_duration_set(show_anim, 1.0);
|
||||
efl_animation_target_set(show_anim, btn);
|
||||
efl_animation_final_state_keep_set(show_anim, EINA_TRUE);
|
||||
|
||||
//Hide Animation
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(hide_anim, 1.0, 0.0);
|
||||
efl_animation_duration_set(hide_anim, 1.0);
|
||||
efl_animation_target_set(hide_anim, btn);
|
||||
efl_animation_final_state_keep_set(hide_anim, EINA_TRUE);
|
||||
|
||||
|
||||
|
@ -199,7 +183,15 @@ test_efl_anim_repeat(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
//Initialize App Data
|
||||
ad->show_anim = show_anim;
|
||||
ad->hide_anim = hide_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->start_btn = start_btn;
|
||||
ad->repeat_count_spin = repeat_count_spin;
|
||||
ad->repeat_mode_spin = repeat_mode_spin;
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _App_Data
|
|||
{
|
||||
Efl_Animation *cw_45_degrees_anim;
|
||||
Efl_Animation *ccw_45_degrees_anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
Efl_Animation_Player *anim_obj;
|
||||
|
||||
Eina_Bool is_btn_rotated;
|
||||
} App_Data;
|
||||
|
@ -19,19 +19,15 @@ _anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
printf("Animation has been ended!\n");
|
||||
|
||||
ad->anim_obj = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -41,35 +37,23 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
if (ad->anim_obj)
|
||||
efl_animation_object_cancel(ad->anim_obj);
|
||||
|
||||
ad->is_btn_rotated = !(ad->is_btn_rotated);
|
||||
|
||||
if (ad->is_btn_rotated)
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->cw_45_degrees_anim);
|
||||
elm_object_text_set(obj, "Start Rotate Animation from 45 to 0 degrees");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->cw_45_degrees_anim);
|
||||
efl_text_set(obj, "Start Rotate Animation from 45 to 0 degrees");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->ccw_45_degrees_anim);
|
||||
elm_object_text_set(obj, "Start Rotate Animation from 0 to 45 degrees");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->ccw_45_degrees_anim);
|
||||
efl_text_set(obj, "Start Rotate Animation from 0 to 45 degrees");
|
||||
}
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(ad->anim_obj);
|
||||
efl_player_start(ad->anim_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -99,23 +83,30 @@ test_efl_anim_rotate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
evas_object_show(btn);
|
||||
|
||||
//Rotate from 0 to 45 degrees Animation
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
efl_animation_rotate_set(cw_45_degrees_anim, 0.0, 45.0, NULL, 0.5, 0.5);
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_set(cw_45_degrees_anim, 0.0, 45.0,NULL, 0.5, 0.5);
|
||||
efl_animation_duration_set(cw_45_degrees_anim, 1.0);
|
||||
efl_animation_target_set(cw_45_degrees_anim, btn);
|
||||
efl_animation_final_state_keep_set(cw_45_degrees_anim, EINA_TRUE);
|
||||
|
||||
//Rotate from 45 to 0 degrees Animation
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_set(ccw_45_degrees_anim, 45.0, 0.0, NULL, 0.5, 0.5);
|
||||
efl_animation_duration_set(ccw_45_degrees_anim, 1.0);
|
||||
efl_animation_target_set(ccw_45_degrees_anim, btn);
|
||||
efl_animation_final_state_keep_set(ccw_45_degrees_anim, EINA_TRUE);
|
||||
|
||||
//Initialize App Data
|
||||
ad->cw_45_degrees_anim = cw_45_degrees_anim;
|
||||
ad->ccw_45_degrees_anim = ccw_45_degrees_anim;
|
||||
ad->anim_obj = NULL;
|
||||
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->is_btn_rotated = EINA_FALSE;
|
||||
|
||||
//Button to start animation
|
||||
|
@ -159,23 +150,31 @@ test_efl_anim_rotate_relative(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS
|
|||
evas_object_show(pivot);
|
||||
|
||||
//Rotate from 0 to 45 degrees Animation
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_set(cw_45_degrees_anim, 0.0, 45.0, pivot, 0.5, 0.5);
|
||||
efl_animation_duration_set(cw_45_degrees_anim, 1.0);
|
||||
efl_animation_target_set(cw_45_degrees_anim, btn);
|
||||
efl_animation_final_state_keep_set(cw_45_degrees_anim, EINA_TRUE);
|
||||
|
||||
//Rotate from 45 to 0 degrees Animation
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_set(ccw_45_degrees_anim, 45.0, 0.0, pivot, 0.5, 0.5);
|
||||
efl_animation_duration_set(ccw_45_degrees_anim, 1.0);
|
||||
efl_animation_target_set(ccw_45_degrees_anim, btn);
|
||||
efl_animation_final_state_keep_set(ccw_45_degrees_anim, EINA_TRUE);
|
||||
|
||||
//Initialize App Data
|
||||
ad->cw_45_degrees_anim = cw_45_degrees_anim;
|
||||
ad->ccw_45_degrees_anim = ccw_45_degrees_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
ad->is_btn_rotated = EINA_FALSE;
|
||||
|
||||
//Button to start animation
|
||||
|
@ -219,23 +218,30 @@ test_efl_anim_rotate_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS
|
|||
evas_object_show(abs_center);
|
||||
|
||||
//Rotate from 0 to 45 degrees Animation
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
Efl_Animation *cw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_absolute_set(cw_45_degrees_anim, 0.0, 45.0, 0, 0);
|
||||
efl_animation_duration_set(cw_45_degrees_anim, 1.0);
|
||||
efl_animation_target_set(cw_45_degrees_anim, btn);
|
||||
efl_animation_final_state_keep_set(cw_45_degrees_anim, EINA_TRUE);
|
||||
|
||||
//Rotate from 45 to 0 degrees Animation
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, NULL);
|
||||
Efl_Animation *ccw_45_degrees_anim = efl_add(EFL_ANIMATION_ROTATE_CLASS, win);
|
||||
efl_animation_rotate_absolute_set(ccw_45_degrees_anim, 45.0, 0.0, 0, 0);
|
||||
efl_animation_duration_set(ccw_45_degrees_anim, 1.0);
|
||||
efl_animation_target_set(ccw_45_degrees_anim, btn);
|
||||
efl_animation_final_state_keep_set(ccw_45_degrees_anim, EINA_TRUE);
|
||||
|
||||
//Initialize App Data
|
||||
ad->cw_45_degrees_anim = cw_45_degrees_anim;
|
||||
ad->ccw_45_degrees_anim = ccw_45_degrees_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->is_btn_rotated = EINA_FALSE;
|
||||
|
||||
//Button to start animation
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _App_Data
|
|||
{
|
||||
Efl_Animation *scale_double_anim;
|
||||
Efl_Animation *scale_half_anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
Efl_Animation_Player *anim_obj;
|
||||
|
||||
Eina_Bool is_btn_scaled;
|
||||
} App_Data;
|
||||
|
@ -19,19 +19,15 @@ _anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
printf("Animation has been ended!\n");
|
||||
|
||||
ad->anim_obj = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -41,35 +37,23 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
if (ad->anim_obj)
|
||||
efl_animation_object_cancel(ad->anim_obj);
|
||||
|
||||
ad->is_btn_scaled = !(ad->is_btn_scaled);
|
||||
|
||||
if (ad->is_btn_scaled)
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->scale_double_anim);
|
||||
elm_object_text_set(obj, "Start Scale Animation to zoom out");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->scale_double_anim);
|
||||
efl_text_set(obj, "Start Scale Animation to zoom out");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->scale_half_anim);
|
||||
elm_object_text_set(obj, "Start Scale Animation to zoom in");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->scale_half_anim);
|
||||
efl_text_set(obj, "Start Scale Animation to zoom in");
|
||||
}
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(ad->anim_obj);
|
||||
efl_player_start(ad->anim_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -99,23 +83,32 @@ test_efl_anim_scale(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
|
|||
evas_object_show(btn);
|
||||
|
||||
//Scale Animation to zoom in
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, NULL, 0.5, 0.5);
|
||||
efl_animation_duration_set(scale_double_anim, 1.0);
|
||||
efl_animation_target_set(scale_double_anim, btn);
|
||||
efl_animation_final_state_keep_set(scale_double_anim, EINA_TRUE);
|
||||
|
||||
//Scale Animation to zoom out
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, NULL, 0.5, 0.5);
|
||||
efl_animation_duration_set(scale_half_anim, 1.0);
|
||||
efl_animation_target_set(scale_half_anim, btn);
|
||||
efl_animation_final_state_keep_set(scale_half_anim, EINA_TRUE);
|
||||
|
||||
//Initialize App Data
|
||||
ad->scale_double_anim = scale_double_anim;
|
||||
ad->scale_half_anim = scale_half_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, NULL,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->is_btn_scaled = EINA_FALSE;
|
||||
|
||||
//Button to start animation
|
||||
|
@ -159,23 +152,29 @@ test_efl_anim_scale_relative(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
|
|||
evas_object_show(pivot);
|
||||
|
||||
//Scale Animation to zoom in
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, pivot, 0.5, 0.5);
|
||||
efl_animation_duration_set(scale_double_anim, 1.0);
|
||||
efl_animation_target_set(scale_double_anim, btn);
|
||||
efl_animation_final_state_keep_set(scale_double_anim, EINA_TRUE);
|
||||
|
||||
//Scale Animation to zoom out
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, pivot, 0.5, 0.5);
|
||||
efl_animation_duration_set(scale_half_anim, 1.0);
|
||||
efl_animation_target_set(scale_half_anim, btn);
|
||||
efl_animation_final_state_keep_set(scale_half_anim, EINA_TRUE);
|
||||
|
||||
//Initialize App Data
|
||||
ad->scale_double_anim = scale_double_anim;
|
||||
ad->scale_half_anim = scale_half_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->is_btn_scaled = EINA_FALSE;
|
||||
|
||||
//Button to start animation
|
||||
|
@ -219,23 +218,29 @@ test_efl_anim_scale_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
|
|||
evas_object_show(abs_center);
|
||||
|
||||
//Scale Animation to zoom in
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
Efl_Animation *scale_double_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_absolute_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, 0, 0);
|
||||
efl_animation_duration_set(scale_double_anim, 1.0);
|
||||
efl_animation_target_set(scale_double_anim, btn);
|
||||
efl_animation_final_state_keep_set(scale_double_anim, EINA_TRUE);
|
||||
|
||||
//Scale Animation to zoom out
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, NULL);
|
||||
Efl_Animation *scale_half_anim = efl_add(EFL_ANIMATION_SCALE_CLASS, win);
|
||||
efl_animation_scale_absolute_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, 0, 0);
|
||||
efl_animation_duration_set(scale_half_anim, 1.0);
|
||||
efl_animation_target_set(scale_half_anim, btn);
|
||||
efl_animation_final_state_keep_set(scale_half_anim, EINA_TRUE);
|
||||
|
||||
//Initialize App Data
|
||||
ad->scale_double_anim = scale_double_anim;
|
||||
ad->scale_half_anim = scale_half_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->is_btn_scaled = EINA_FALSE;
|
||||
|
||||
//Button to start animation
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _App_Data
|
|||
{
|
||||
Efl_Animation *show_anim;
|
||||
Efl_Animation *hide_anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
Efl_Animation_Player *anim_obj;
|
||||
|
||||
Evas_Object *start_delay_spin;
|
||||
|
||||
|
@ -28,14 +28,12 @@ _anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
|||
printf("Animation has been ended!\n");
|
||||
|
||||
elm_object_disabled_set(ad->start_delay_spin, EINA_FALSE);
|
||||
|
||||
ad->anim_obj = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -45,9 +43,6 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
|||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
if (ad->anim_obj)
|
||||
efl_animation_object_cancel(ad->anim_obj);
|
||||
|
||||
ad->is_btn_visible = !(ad->is_btn_visible);
|
||||
|
||||
double start_delay = elm_spinner_value_get(ad->start_delay_spin);
|
||||
|
@ -59,8 +54,8 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
|||
efl_animation_start_delay_set(ad->show_anim, start_delay);
|
||||
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->show_anim);
|
||||
elm_object_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->show_anim);
|
||||
efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -68,21 +63,12 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
|||
efl_animation_start_delay_set(ad->hide_anim, start_delay);
|
||||
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->hide_anim);
|
||||
elm_object_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->hide_anim);
|
||||
efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
|
||||
}
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(ad->anim_obj);
|
||||
efl_player_start(ad->anim_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -112,17 +98,15 @@ test_efl_anim_start_delay(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
evas_object_show(btn);
|
||||
|
||||
//Show Animation
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(show_anim, 0.0, 1.0);
|
||||
efl_animation_duration_set(show_anim, 1.0);
|
||||
efl_animation_target_set(show_anim, btn);
|
||||
efl_animation_final_state_keep_set(show_anim, EINA_TRUE);
|
||||
|
||||
//Hide Animation
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
|
||||
Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, win);
|
||||
efl_animation_alpha_set(hide_anim, 1.0, 0.0);
|
||||
efl_animation_duration_set(hide_anim, 1.0);
|
||||
efl_animation_target_set(hide_anim, btn);
|
||||
efl_animation_final_state_keep_set(hide_anim, EINA_TRUE);
|
||||
|
||||
|
||||
|
@ -150,7 +134,16 @@ test_efl_anim_start_delay(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
//Initialize App Data
|
||||
ad->show_anim = show_anim;
|
||||
ad->hide_anim = hide_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->start_delay_spin = start_delay_spin;
|
||||
ad->is_btn_visible = EINA_TRUE;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ typedef struct _App_Data
|
|||
{
|
||||
Efl_Animation *translate_rb_anim;
|
||||
Efl_Animation *translate_lt_anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
Efl_Animation_Player *anim_obj;
|
||||
|
||||
Eina_Bool is_btn_translated;
|
||||
} App_Data;
|
||||
|
@ -19,19 +19,15 @@ _anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
printf("Animation has been ended!\n");
|
||||
|
||||
ad->anim_obj = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Efl_Animation_Object_Running_Event_Info *event_info = event->info;
|
||||
Efl_Animation_Player_Running_Event_Info *event_info = event->info;
|
||||
double progress = event_info->progress;
|
||||
printf("Animation is running! Current progress(%lf)\n", progress);
|
||||
}
|
||||
|
@ -41,35 +37,23 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
{
|
||||
App_Data *ad = data;
|
||||
|
||||
if (ad->anim_obj)
|
||||
efl_animation_object_cancel(ad->anim_obj);
|
||||
|
||||
ad->is_btn_translated = !(ad->is_btn_translated);
|
||||
|
||||
if (ad->is_btn_translated)
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->translate_rb_anim);
|
||||
elm_object_text_set(obj, "Start Translate Animation to left top");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->translate_rb_anim);
|
||||
efl_text_set(obj, "Start Translate Animation to left top");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create Animation Object from Animation
|
||||
ad->anim_obj = efl_animation_object_create(ad->translate_lt_anim);
|
||||
elm_object_text_set(obj, "Start Translate Animation to right bottom");
|
||||
efl_animation_player_animation_set(ad->anim_obj, ad->translate_lt_anim);
|
||||
efl_text_set(obj, "Start Translate Animation to right bottom");
|
||||
}
|
||||
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
|
||||
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Let Animation Object start animation
|
||||
efl_animation_object_start(ad->anim_obj);
|
||||
efl_player_start(ad->anim_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -99,23 +83,29 @@ test_efl_anim_translate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo
|
|||
evas_object_show(btn);
|
||||
|
||||
//Translate Animation to right bottom relatively
|
||||
Efl_Animation *translate_rb_anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, NULL);
|
||||
Efl_Animation *translate_rb_anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_set(translate_rb_anim, 0, 0, 100, 100);
|
||||
efl_animation_duration_set(translate_rb_anim, 1.0);
|
||||
efl_animation_target_set(translate_rb_anim, btn);
|
||||
efl_animation_final_state_keep_set(translate_rb_anim, EINA_TRUE);
|
||||
|
||||
//Translate Animation to left top relatively
|
||||
Efl_Animation *translate_lt_anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, NULL);
|
||||
Efl_Animation *translate_lt_anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_set(translate_lt_anim, 100, 100, 0, 0);
|
||||
efl_animation_duration_set(translate_lt_anim, 1.0);
|
||||
efl_animation_target_set(translate_lt_anim, btn);
|
||||
efl_animation_final_state_keep_set(translate_lt_anim, EINA_TRUE);
|
||||
|
||||
//Initialize App Data
|
||||
ad->translate_rb_anim = translate_rb_anim;
|
||||
ad->translate_lt_anim = translate_lt_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
ad->is_btn_translated = EINA_FALSE;
|
||||
|
||||
//Button to start animation
|
||||
|
@ -159,24 +149,29 @@ test_efl_anim_translate_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_U
|
|||
evas_object_show(abs_center);
|
||||
|
||||
//Translate Animation to right bottom absolutely
|
||||
Efl_Animation *translate_rb_anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, NULL);
|
||||
Efl_Animation *translate_rb_anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_absolute_set(translate_rb_anim, 0, 0, 100, 100);
|
||||
efl_animation_duration_set(translate_rb_anim, 1.0);
|
||||
efl_animation_target_set(translate_rb_anim, btn);
|
||||
efl_animation_final_state_keep_set(translate_rb_anim, EINA_TRUE);
|
||||
|
||||
//Translate Animation to left top absolutely
|
||||
Efl_Animation *translate_lt_anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, NULL);
|
||||
Efl_Animation *translate_lt_anim = efl_add(EFL_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_absolute_set(translate_lt_anim, 100, 100, 0, 0);
|
||||
efl_animation_duration_set(translate_lt_anim, 1.0);
|
||||
efl_animation_target_set(translate_lt_anim, btn);
|
||||
efl_animation_final_state_keep_set(translate_lt_anim, EINA_TRUE);
|
||||
|
||||
//Initialize App Data
|
||||
ad->translate_rb_anim = translate_rb_anim;
|
||||
ad->translate_lt_anim = translate_lt_anim;
|
||||
ad->anim_obj = NULL;
|
||||
ad->is_btn_translated = EINA_FALSE;
|
||||
ad->anim_obj = efl_add(EFL_ANIMATION_PLAYER_CLASS, win,
|
||||
efl_animation_player_target_set(efl_added, btn));
|
||||
//Register callback called when animation starts
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
|
||||
//Register callback called when animation ends
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
|
||||
//Register callback called while animation is executed
|
||||
efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
|
||||
|
||||
//Button to start animation
|
||||
Evas_Object *btn2 = elm_button_add(win);
|
||||
|
|
|
@ -82,6 +82,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
|
|||
#include "interfaces/efl_image_animated.eo.h"
|
||||
#include "interfaces/efl_image_load.eo.h"
|
||||
#include "interfaces/efl_part.eo.h"
|
||||
#include "interfaces/efl_playable.eo.h"
|
||||
#include "interfaces/efl_player.eo.h"
|
||||
#include "interfaces/efl_text.eo.h"
|
||||
#include "interfaces/efl_text_types.eot.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "interfaces/efl_image_animated.eo.c"
|
||||
#include "interfaces/efl_image_load.eo.c"
|
||||
#include "interfaces/efl_part.eo.c"
|
||||
#include "interfaces/efl_playable.eo.c"
|
||||
#include "interfaces/efl_player.eo.c"
|
||||
#include "interfaces/efl_text.eo.c"
|
||||
#include "interfaces/efl_text_properties.eo.c"
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
interface Efl.Playable
|
||||
{
|
||||
[[Efl media playable interface]]
|
||||
methods {
|
||||
@property length {
|
||||
[[Get the length of play for the media file.]]
|
||||
get {
|
||||
}
|
||||
values {
|
||||
length: double; [[The length of the stream in seconds.]]
|
||||
}
|
||||
}
|
||||
@property playable {
|
||||
get {
|
||||
}
|
||||
values {
|
||||
playable: bool;
|
||||
}
|
||||
}
|
||||
@property seekable {
|
||||
[[Get whether the media file is seekable.]]
|
||||
get {
|
||||
}
|
||||
values {
|
||||
seekable: bool; [[$true if seekable.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,8 +2,14 @@ interface Efl.Player
|
|||
{
|
||||
[[Efl media player interface]]
|
||||
methods {
|
||||
start {
|
||||
[[Start a playing playable object.]]
|
||||
}
|
||||
stop {
|
||||
[[Stop playable object.]]
|
||||
}
|
||||
@property playable {
|
||||
[[Whether or not the object data can be played.]]
|
||||
[[Whether or not the playable can be played.]]
|
||||
get {
|
||||
}
|
||||
values {
|
||||
|
|
|
@ -99,7 +99,7 @@ _key_action_move(Evas_Object *obj, const char *params)
|
|||
static Eina_Bool
|
||||
_key_action_play(Evas_Object *obj, const char *params EINA_UNUSED)
|
||||
{
|
||||
if (elm_video_is_playing_get(obj))
|
||||
if (efl_player_play_get(obj))
|
||||
elm_video_pause(obj);
|
||||
else
|
||||
elm_video_play(obj);
|
||||
|
@ -305,33 +305,39 @@ _efl_ui_video_emotion_get(Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd)
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_video_play(Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd)
|
||||
_efl_ui_video_efl_player_start(Eo *obj, Efl_Ui_Video_Data *sd EINA_UNUSED)
|
||||
{
|
||||
if (emotion_object_play_get(sd->emotion)) return;
|
||||
efl_player_position_set(obj, 0.0);
|
||||
efl_player_play_set(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_video_efl_player_play_set(Eo *obj, Efl_Ui_Video_Data *sd, Eina_Bool play)
|
||||
{
|
||||
if (emotion_object_play_get(sd->emotion) == !!play) return;
|
||||
|
||||
if (play)
|
||||
{
|
||||
ELM_SAFE_FREE(sd->timer, ecore_timer_del);
|
||||
sd->stop = EINA_FALSE;
|
||||
emotion_object_play_set(sd->emotion, EINA_TRUE);
|
||||
elm_layout_signal_emit(obj, "elm,video,play", "elm");
|
||||
}
|
||||
|
||||
/* FIXME: pause will setup timer and go into sleep or
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: pause will setup timer and go into sleep or
|
||||
* hibernate after a while without activity.
|
||||
*/
|
||||
EOLIAN static void
|
||||
_efl_ui_video_pause(Eo *obj, Efl_Ui_Video_Data *sd)
|
||||
{
|
||||
if (!emotion_object_play_get(sd->emotion)) return;
|
||||
|
||||
if (!sd->timer) sd->timer = ecore_timer_add(20.0, _suspend_cb, obj);
|
||||
emotion_object_play_set(sd->emotion, EINA_FALSE);
|
||||
elm_layout_signal_emit(obj, "elm,video,pause", "elm");
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: stop should go into hibernate state directly.
|
||||
*/
|
||||
EOLIAN static void
|
||||
_efl_ui_video_stop(Eo *obj, Efl_Ui_Video_Data *sd)
|
||||
_efl_ui_video_efl_player_stop(Eo *obj, Efl_Ui_Video_Data *sd)
|
||||
{
|
||||
if (!emotion_object_play_get(sd->emotion) && sd->stop) return;
|
||||
|
||||
|
@ -344,7 +350,7 @@ _efl_ui_video_stop(Eo *obj, Efl_Ui_Video_Data *sd)
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_video_is_playing_get(Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd)
|
||||
_efl_ui_video_efl_player_play_get(Eo *obj EINA_UNUSED, Efl_Ui_Video_Data *sd)
|
||||
{
|
||||
return emotion_object_play_get(sd->emotion);
|
||||
}
|
||||
|
@ -445,6 +451,30 @@ elm_video_play_position_get(const Evas_Object *obj)
|
|||
return efl_player_position_get(obj);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_video_is_playing_get(Evas_Object *obj)
|
||||
{
|
||||
return efl_player_play_get(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_video_play(Evas_Object *obj)
|
||||
{
|
||||
efl_player_play_set(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_video_stop(Evas_Object *obj)
|
||||
{
|
||||
efl_player_stop(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_video_pause(Evas_Object *obj)
|
||||
{
|
||||
efl_player_play_set(obj, EINA_FALSE);
|
||||
}
|
||||
|
||||
/* Internal EO APIs and hidden overrides */
|
||||
|
||||
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_video, Efl_Ui_Video_Data)
|
||||
|
|
|
@ -23,16 +23,6 @@ class Efl.Ui.Video (Efl.Ui.Layout, Efl.File,
|
|||
remember: bool; [[$true when the object can remember the last position, $false otherwise]]
|
||||
}
|
||||
}
|
||||
@property is_playing {
|
||||
get {
|
||||
[[Is the video actually playing.
|
||||
|
||||
You should consider watching event on the object instead of
|
||||
polling the object state.
|
||||
]]
|
||||
return: bool; [[$true if the video is playing, $false otherwise]]
|
||||
}
|
||||
}
|
||||
@property emotion {
|
||||
get {
|
||||
[[Get the underlying Emotion object.]]
|
||||
|
@ -50,15 +40,6 @@ class Efl.Ui.Video (Efl.Ui.Layout, Efl.File,
|
|||
return: string; [[A string containing the title.]]
|
||||
}
|
||||
}
|
||||
play {
|
||||
[[Start playing a video.]]
|
||||
}
|
||||
pause {
|
||||
[[Pause a video.]]
|
||||
}
|
||||
stop {
|
||||
[[Stop a video.]]
|
||||
}
|
||||
}
|
||||
implements {
|
||||
class.constructor;
|
||||
|
@ -66,5 +47,8 @@ class Efl.Ui.Video (Efl.Ui.Layout, Efl.File,
|
|||
Efl.File.file { get; set; }
|
||||
Efl.Ui.Widget.widget_event;
|
||||
Efl.Access.Widget.Action.elm_actions { get; }
|
||||
Efl.Player.start;
|
||||
Efl.Player.stop;
|
||||
Efl.Player.play { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,4 +135,36 @@ EAPI void elm_video_play_position_set(Evas_Object *obj, double position);
|
|||
*/
|
||||
EAPI double elm_video_play_position_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Get whether the video actually playing.
|
||||
* You should consider watching event on the object instead of
|
||||
* polling the object state.
|
||||
*
|
||||
* @return @c true if the video is playing, @c false otherwise.
|
||||
*
|
||||
* @ingroup Elm_Video
|
||||
*/
|
||||
EAPI Eina_Bool elm_video_is_playing_get(Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Start playing a video.
|
||||
*
|
||||
* @ingroup Elm_Video
|
||||
*/
|
||||
EAPI void elm_video_play(Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Stop a video.
|
||||
*
|
||||
* @ingroup Elm_Video
|
||||
*/
|
||||
EAPI void elm_video_stop(Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @brief Pause a video.
|
||||
*
|
||||
* @ingroup Elm_Video
|
||||
*/
|
||||
EAPI void elm_video_pause(Evas_Object *obj);
|
||||
|
||||
#include "efl_ui_video.eo.legacy.h"
|
||||
|
|
|
@ -3386,45 +3386,45 @@ typedef Eo Efl_Animation_Group_Sequential;
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_OBJECT_EO_CLASS_TYPE
|
||||
#ifndef _EFL_ANIMATION_PLAYER_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_PLAYER_EO_CLASS_TYPE
|
||||
|
||||
typedef Eo Efl_Animation_Object;
|
||||
typedef Eo Efl_Animation_Player;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _EFL_ANIMATION_OBJECT_ALPHA_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_OBJECT_ALPHA_EO_CLASS_TYPE
|
||||
#ifndef _EFL_ANIMATION_PLAYER_ALPHA_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_PLAYER_ALPHA_EO_CLASS_TYPE
|
||||
|
||||
typedef Eo Efl_Animation_Object_Alpha;
|
||||
typedef Eo Efl_Animation_Player_Alpha;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _EFL_ANIMATION_OBJECT_ROTATE_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_OBJECT_ROTATE_EO_CLASS_TYPE
|
||||
#ifndef _EFL_ANIMATION_PLAYER_ROTATE_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_PLAYER_ROTATE_EO_CLASS_TYPE
|
||||
|
||||
typedef Eo Efl_Animation_Object_Rotate;
|
||||
typedef Eo Efl_Animation_Player_Rotate;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _EFL_ANIMATION_OBJECT_SCALE_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_OBJECT_SCALE_EO_CLASS_TYPE
|
||||
#ifndef _EFL_ANIMATION_PLAYER_SCALE_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_PLAYER_SCALE_EO_CLASS_TYPE
|
||||
|
||||
typedef Eo Efl_Animation_Object_Scale;
|
||||
typedef Eo Efl_Animation_Player_Scale;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _EFL_ANIMATION_OBJECT_TRANSLATE_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_OBJECT_TRANSLATE_EO_CLASS_TYPE
|
||||
#ifndef _EFL_ANIMATION_PLAYER_TRANSLATE_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_PLAYER_TRANSLATE_EO_CLASS_TYPE
|
||||
|
||||
typedef Eo Efl_Animation_Object_Translate;
|
||||
typedef Eo Efl_Animation_Player_Translate;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _EFL_ANIMATION_OBJECT_GROUP_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_OBJECT_GROUP_EO_CLASS_TYPE
|
||||
#ifndef _EFL_ANIMATION_PLAYER_GROUP_EO_CLASS_TYPE
|
||||
#define _EFL_ANIMATION_PLAYER_GROUP_EO_CLASS_TYPE
|
||||
|
||||
typedef Eo Efl_Animation_Object_Group;
|
||||
typedef Eo Efl_Animation_Player_Group;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -3442,16 +3442,16 @@ typedef Eo Efl_Animation_Group_Sequential;
|
|||
|
||||
#endif
|
||||
|
||||
struct _Efl_Animation_Object_Running_Event_Info
|
||||
struct _Efl_Animation_Player_Running_Event_Info
|
||||
{
|
||||
double progress;
|
||||
};
|
||||
|
||||
#define EFL_ANIMATION_GROUP_DURATION_NONE -1
|
||||
#define EFL_ANIMATION_OBJECT_GROUP_DURATION_NONE -1
|
||||
#define EFL_ANIMATION_PLAYER_GROUP_DURATION_NONE -1
|
||||
|
||||
#define EFL_ANIMATION_REPEAT_INFINITE -1
|
||||
#define EFL_ANIMATION_OBJECT_REPEAT_INFINITE -1
|
||||
#define EFL_ANIMATION_PLAYER_REPEAT_INFINITE -1
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -61,14 +61,7 @@
|
|||
#include "canvas/efl_animation_group.eo.h"
|
||||
#include "canvas/efl_animation_group_parallel.eo.h"
|
||||
#include "canvas/efl_animation_group_sequential.eo.h"
|
||||
#include "canvas/efl_animation_object.eo.h"
|
||||
#include "canvas/efl_animation_object_alpha.eo.h"
|
||||
#include "canvas/efl_animation_object_rotate.eo.h"
|
||||
#include "canvas/efl_animation_object_scale.eo.h"
|
||||
#include "canvas/efl_animation_object_translate.eo.h"
|
||||
#include "canvas/efl_animation_object_group.eo.h"
|
||||
#include "canvas/efl_animation_object_group_parallel.eo.h"
|
||||
#include "canvas/efl_animation_object_group_sequential.eo.h"
|
||||
#include "canvas/efl_animation_player.eo.h"
|
||||
|
||||
#endif /* EFL_EO_API_SUPPORT */
|
||||
|
||||
|
|
|
@ -89,79 +89,10 @@ EWAPI extern const Efl_Event_Description _EVAS_CANVAS_EVENT_VIEWPORT_RESIZE;
|
|||
#define EFL_CANVAS_GROUP_ADD_OPS(kls) EFL_OBJECT_OP_FUNC(efl_canvas_group_add, _##kls##_efl_canvas_group_group_add)
|
||||
#define EFL_CANVAS_GROUP_ADD_DEL_OPS(kls) EFL_CANVAS_GROUP_ADD_OPS(kls), EFL_CANVAS_GROUP_DEL_OPS(kls)
|
||||
|
||||
/* Efl.Animation.Object */
|
||||
EOAPI void efl_animation_object_target_set(Eo *obj, Efl_Canvas_Object *target);
|
||||
EOAPI Efl_Canvas_Object *efl_animation_object_target_get(const Eo *obj);
|
||||
|
||||
EOAPI void efl_animation_object_final_state_keep_set(Eo *obj, Eina_Bool state_keep);
|
||||
EOAPI Eina_Bool efl_animation_object_final_state_keep_get(const Eo *obj);
|
||||
|
||||
EOAPI void efl_animation_object_duration_set(Eo *obj, double duration);
|
||||
EOAPI double efl_animation_object_duration_get(const Eo *obj);
|
||||
|
||||
EOAPI double efl_animation_object_total_duration_get(const Eo *obj);
|
||||
|
||||
EOAPI void efl_animation_object_start_delay_set(Eo *obj, double delay_time);
|
||||
EOAPI double efl_animation_object_start_delay_get(const Eo *obj);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EFL_ANIMATION_OBJECT_REPEAT_MODE_RESTART = 0,
|
||||
EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE
|
||||
} Efl_Animation_Object_Repeat_Mode;
|
||||
|
||||
EOAPI void efl_animation_object_repeat_mode_set(Eo *obj, Efl_Animation_Object_Repeat_Mode mode);
|
||||
EOAPI Efl_Animation_Object_Repeat_Mode efl_animation_object_repeat_mode_get(const Eo *obj);
|
||||
|
||||
EOAPI void efl_animation_object_repeat_count_set(Eo *obj, int count);
|
||||
EOAPI int efl_animation_object_repeat_count_get(const Eo *obj);
|
||||
|
||||
EOAPI void efl_animation_object_interpolator_set(Eo *obj, Efl_Object *interpolator);
|
||||
EOAPI Efl_Object *efl_animation_object_interpolator_get(const Eo *obj);
|
||||
|
||||
EOAPI void efl_animation_object_target_state_save(Eo *obj);
|
||||
EOAPI void efl_animation_object_target_state_reset(Eo *obj);
|
||||
EOAPI void efl_animation_object_target_map_reset(Eo *obj);
|
||||
|
||||
EWAPI extern const Efl_Event_Description _EFL_ANIMATION_OBJECT_EVENT_PRE_STARTED;
|
||||
#define EFL_ANIMATION_OBJECT_EVENT_PRE_STARTED (&(_EFL_ANIMATION_OBJECT_EVENT_PRE_STARTED))
|
||||
/* Efl.Animation.Object END */
|
||||
|
||||
/* Efl.Animation.Object.Alpha */
|
||||
EOAPI void efl_animation_object_alpha_set(Eo *obj, double from_alpha, double to_alpha);
|
||||
EOAPI void efl_animation_object_alpha_get(const Eo *obj, double *from_alpha, double *to_alpha);
|
||||
/* Efl.Animation.Object.Alpha END */
|
||||
|
||||
/* Efl.Animation.Object.Rotate */
|
||||
EOAPI void efl_animation_object_rotate_set(Eo *obj, double from_degree, double to_degree, Efl_Canvas_Object *pivot, double cx, double cy);
|
||||
EOAPI void efl_animation_object_rotate_get(const Eo *obj, double *from_degree, double *to_degree, Efl_Canvas_Object **pivot, double *cx, double *cy);
|
||||
|
||||
EOAPI void efl_animation_object_rotate_absolute_set(Eo *obj, double from_degree, double to_degree, int cx, int cy);
|
||||
EOAPI void efl_animation_object_rotate_absolute_get(const Eo *obj, double *from_degree, double *to_degree, int *cx, int *cy);
|
||||
/* Efl.Animation.Object.Rotate END */
|
||||
|
||||
/* Efl.Animation.Object.Scale */
|
||||
EOAPI void efl_animation_object_scale_set(Eo *obj, double from_scale_x, double from_scale_y, double to_scale_x, double to_scale_y, Efl_Canvas_Object *pivot, double cx, double cy);
|
||||
EOAPI void efl_animation_object_scale_get(const Eo *obj, double *from_scale_x, double *from_scale_y, double *to_scale_x, double *to_scale_y, Efl_Canvas_Object **pivot, double *cx, double *cy);
|
||||
|
||||
EOAPI void efl_animation_object_scale_absolute_set(Eo *obj, double from_scale_x, double from_scale_y, double to_scale_x, double to_scale_y, int cx, int cy);
|
||||
EOAPI void efl_animation_object_scale_absolute_get(const Eo *obj, double *from_scale_x, double *from_scale_y, double *to_scale_x, double *to_scale_y, int *cx, int *cy);
|
||||
/* Efl.Animation.Object.Scale END */
|
||||
|
||||
/* Efl.Animation.Object.Translate */
|
||||
EOAPI void efl_animation_object_translate_set(Eo *obj, int from_x, int from_y, int to_x, int to_y);
|
||||
EOAPI void efl_animation_object_translate_get(const Eo *obj, int *from_x, int *from_y, int *to_x, int *to_y);
|
||||
|
||||
EOAPI void efl_animation_object_translate_absolute_set(Eo *obj, int from_x, int from_y, int to_x, int to_y);
|
||||
EOAPI void efl_animation_object_translate_absolute_get(const Eo *obj, int *from_x, int *from_y, int *to_x, int *to_y);
|
||||
/* Efl.Animation.Object.Translate END */
|
||||
|
||||
/* Efl.Animation.Object.Group */
|
||||
EOAPI void efl_animation_object_group_object_add(Eo *obj, Efl_Animation_Object *anim_obj);
|
||||
EOAPI void efl_animation_object_group_object_del(Eo *obj, Efl_Animation_Object *anim_obj);
|
||||
|
||||
EOAPI Eina_List *efl_animation_object_group_objects_get(Eo *obj);
|
||||
/* Efl.Animation.Object.Group END */
|
||||
/* Efl.Animation.Player */
|
||||
EWAPI extern const Efl_Event_Description _EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED;
|
||||
#define EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED (&(_EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED))
|
||||
/* Efl.Animation.Player END */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,37 +1,13 @@
|
|||
#include "efl_animation_private.h"
|
||||
|
||||
static void
|
||||
_target_del_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
Eo *eo_obj = data;
|
||||
|
||||
EFL_ANIMATION_DATA_GET(eo_obj, pd);
|
||||
|
||||
pd->target = NULL;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_target_set(Eo *eo_obj,
|
||||
Efl_Animation_Data *pd,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
efl_event_callback_add(target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
|
||||
|
||||
pd->target = target;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Canvas_Object *
|
||||
_efl_animation_target_get(Eo *eo_obj EINA_UNUSED, Efl_Animation_Data *pd)
|
||||
{
|
||||
return pd->target;
|
||||
}
|
||||
#define MY_CLASS EFL_ANIMATION_CLASS
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_duration_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Data *pd,
|
||||
double duration)
|
||||
double sec)
|
||||
{
|
||||
pd->duration = duration;
|
||||
pd->duration = sec;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
|
@ -40,21 +16,14 @@ _efl_animation_duration_get(Eo *eo_obj EINA_UNUSED, Efl_Animation_Data *pd)
|
|||
return pd->duration;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_total_duration_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Data *pd)
|
||||
{
|
||||
return pd->duration;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_final_state_keep_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Data *pd,
|
||||
Eina_Bool keep_final_state)
|
||||
Eina_Bool keep)
|
||||
{
|
||||
if (pd->keep_final_state == keep_final_state) return;
|
||||
if (pd->keep_final_state == keep) return;
|
||||
|
||||
pd->keep_final_state = !!keep_final_state;
|
||||
pd->keep_final_state = !!keep;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
|
@ -64,27 +33,6 @@ _efl_animation_final_state_keep_get(Eo *eo_obj EINA_UNUSED,
|
|||
return pd->keep_final_state;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Animation_Object *
|
||||
_efl_animation_object_create(Eo *eo_obj, Efl_Animation_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Efl_Animation_Object *anim_obj
|
||||
= efl_add(EFL_ANIMATION_OBJECT_CLASS, NULL);
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
efl_animation_object_target_set(anim_obj, target);
|
||||
|
||||
Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
|
||||
efl_animation_object_final_state_keep_set(anim_obj, state_keep);
|
||||
|
||||
double duration = efl_animation_duration_get(eo_obj);
|
||||
efl_animation_object_duration_set(anim_obj, duration);
|
||||
|
||||
int repeat_count = efl_animation_repeat_count_get(eo_obj);
|
||||
efl_animation_object_repeat_count_set(anim_obj, repeat_count);
|
||||
|
||||
return anim_obj;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_repeat_mode_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Data *pd,
|
||||
|
@ -121,11 +69,11 @@ _efl_animation_repeat_count_get(Eo *eo_obj EINA_UNUSED, Efl_Animation_Data *pd)
|
|||
EOLIAN static void
|
||||
_efl_animation_start_delay_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Data *pd,
|
||||
double delay_time)
|
||||
double sec)
|
||||
{
|
||||
if (delay_time < 0.0) return;
|
||||
if (sec < 0.0) return;
|
||||
|
||||
pd->start_delay_time = delay_time;
|
||||
pd->start_delay_time = sec;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
|
@ -150,34 +98,41 @@ _efl_animation_interpolator_get(Eo *eo_obj EINA_UNUSED,
|
|||
return pd->interpolator;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_animation_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Animation_Data *pd)
|
||||
EOLIAN static double
|
||||
_efl_animation_animation_apply(Eo *eo_obj,
|
||||
Efl_Animation_Data *pd EINA_UNUSED,
|
||||
double progress,
|
||||
Efl_Canvas_Object *target EINA_UNUSED)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
Efl_Interpolator *interpolator = efl_animation_interpolator_get(eo_obj);
|
||||
if (interpolator)
|
||||
progress = efl_interpolator_interpolate(interpolator, progress);
|
||||
|
||||
pd->target = NULL;
|
||||
|
||||
pd->duration = 0.0;
|
||||
|
||||
pd->start_delay_time = 0.0;
|
||||
|
||||
pd->repeat_count = 0;
|
||||
|
||||
pd->interpolator = NULL;
|
||||
|
||||
pd->keep_final_state = EINA_FALSE;
|
||||
|
||||
return eo_obj;
|
||||
return progress;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_efl_object_destructor(Eo *eo_obj, Efl_Animation_Data *pd)
|
||||
EOLIAN static double
|
||||
_efl_animation_efl_playable_length_get(Eo *eo_obj, Efl_Animation_Data *pd EINA_UNUSED)
|
||||
{
|
||||
if (pd->target)
|
||||
efl_event_callback_del(pd->target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
|
||||
if (efl_animation_repeat_count_get(eo_obj) == EFL_ANIMATION_REPEAT_INFINITE)
|
||||
{
|
||||
//TODO: what's correct?
|
||||
return (double)EFL_ANIMATION_REPEAT_INFINITE;
|
||||
}
|
||||
|
||||
efl_destructor(efl_super(eo_obj, MY_CLASS));
|
||||
return (efl_animation_duration_get(eo_obj) * (efl_animation_repeat_count_get(eo_obj) + 1));
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_animation_efl_playable_playable_get(Eo *eo_obj EINA_UNUSED, Efl_Animation_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_animation_efl_playable_seekable_get(Eo *eo_obj EINA_UNUSED, Efl_Animation_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
#include "efl_animation.eo.c"
|
||||
|
|
|
@ -1,20 +1,9 @@
|
|||
import efl_animation_types;
|
||||
|
||||
class Efl.Animation (Efl.Object)
|
||||
class Efl.Animation (Efl.Object, Efl.Playable)
|
||||
{
|
||||
[[Efl animation class]]
|
||||
data: Efl_Animation_Data;
|
||||
methods {
|
||||
@property target {
|
||||
[[Target object property]]
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
target: Efl.Canvas.Object; [[Target object which is applied animation.]]
|
||||
}
|
||||
}
|
||||
@property final_state_keep {
|
||||
[[Keep final state property]]
|
||||
set {
|
||||
|
@ -22,7 +11,7 @@ class Efl.Animation (Efl.Object)
|
|||
get {
|
||||
}
|
||||
values {
|
||||
keep_final_state: bool; [[$true to keep final state, $false otherwise.]]
|
||||
keep: bool; [[$true to keep final state, $false otherwise.]]
|
||||
}
|
||||
}
|
||||
@property duration {
|
||||
|
@ -32,15 +21,7 @@ class Efl.Animation (Efl.Object)
|
|||
get {
|
||||
}
|
||||
values {
|
||||
duration: double; [[Duration value.]]
|
||||
}
|
||||
}
|
||||
@property total_duration {
|
||||
[[Total duration property]]
|
||||
get {
|
||||
}
|
||||
values {
|
||||
total_duration: double; [[Total duration value.]]
|
||||
sec: double; [[Duration value.]]
|
||||
}
|
||||
}
|
||||
@property repeat_mode {
|
||||
|
@ -70,7 +51,7 @@ class Efl.Animation (Efl.Object)
|
|||
get {
|
||||
}
|
||||
values {
|
||||
delay_time: double; [[Delay time, in seconds, from when the animation starts until the animation is animated]]
|
||||
sec: double; [[Delay time, in seconds, from when the animation starts until the animation is animated]]
|
||||
}
|
||||
}
|
||||
@property interpolator {
|
||||
|
@ -83,13 +64,17 @@ class Efl.Animation (Efl.Object)
|
|||
interpolator: Efl.Object; [[Interpolator which indicates interpolation fucntion. Efl_Interpolator is required.]]
|
||||
}
|
||||
}
|
||||
object_create {
|
||||
[[Create object of the animation.]]
|
||||
return: Efl.Animation.Object; [[Created object of the animation]]
|
||||
animation_apply {
|
||||
params {
|
||||
@in progress: double;
|
||||
@in target: Efl.Canvas.Object;
|
||||
}
|
||||
return: double; [[Final applied progress.]]
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
Efl.Playable.length { get; }
|
||||
Efl.Playable.seekable { get; }
|
||||
Efl.Playable.playable { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "efl_animation_alpha_private.h"
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_ALPHA_CLASS
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_alpha_alpha_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Alpha_Data *pd,
|
||||
|
@ -22,38 +24,29 @@ _efl_animation_alpha_alpha_get(Eo *eo_obj EINA_UNUSED,
|
|||
*to_alpha = pd->to.alpha;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Animation_Object *
|
||||
_efl_animation_alpha_efl_animation_object_create(Eo *eo_obj,
|
||||
Efl_Animation_Alpha_Data *pd)
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_alpha_efl_animation_animation_apply(Eo *eo_obj,
|
||||
Efl_Animation_Alpha_Data *pd EINA_UNUSED,
|
||||
double progress,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
Efl_Animation_Object_Alpha *anim_obj
|
||||
= efl_add(EFL_ANIMATION_OBJECT_ALPHA_CLASS, NULL);
|
||||
double from_alpha, to_alpha;
|
||||
int cur_alpha;
|
||||
int i;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
efl_animation_object_target_set(anim_obj, target);
|
||||
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
|
||||
if (!target) return progress;
|
||||
|
||||
Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
|
||||
efl_animation_object_final_state_keep_set(anim_obj, state_keep);
|
||||
efl_animation_alpha_get(eo_obj, &from_alpha, &to_alpha);
|
||||
cur_alpha = (int)(GET_STATUS(from_alpha, to_alpha, progress) * 255);
|
||||
|
||||
double duration = efl_animation_duration_get(eo_obj);
|
||||
efl_animation_object_duration_set(anim_obj, duration);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
efl_gfx_map_color_set(target, i, cur_alpha, cur_alpha, cur_alpha, cur_alpha);
|
||||
}
|
||||
|
||||
double start_delay_time = efl_animation_start_delay_get(eo_obj);
|
||||
efl_animation_object_start_delay_set(anim_obj, start_delay_time);
|
||||
|
||||
Efl_Animation_Object_Repeat_Mode repeat_mode =
|
||||
(Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
|
||||
efl_animation_object_repeat_mode_set(anim_obj, repeat_mode);
|
||||
|
||||
int repeat_count = efl_animation_repeat_count_get(eo_obj);
|
||||
efl_animation_object_repeat_count_set(anim_obj, repeat_count);
|
||||
|
||||
Efl_Interpolator *interpolator = efl_animation_interpolator_get(eo_obj);
|
||||
efl_animation_object_interpolator_set(anim_obj, interpolator);
|
||||
|
||||
efl_animation_object_alpha_set(anim_obj, pd->from.alpha, pd->to.alpha);
|
||||
|
||||
return anim_obj;
|
||||
return progress;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
|
|
|
@ -19,6 +19,6 @@ class Efl.Animation.Alpha (Efl.Animation)
|
|||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Animation.object_create;
|
||||
Efl.Animation.animation_apply;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_ALPHA_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
#include "efl_animation_private.h"
|
||||
|
||||
#define EFL_ANIMATION_ALPHA_DATA_GET(o, pd) \
|
||||
Efl_Animation_Alpha_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_ALPHA_CLASS)
|
||||
|
|
|
@ -7,11 +7,7 @@ _efl_animation_group_animation_add(Eo *eo_obj,
|
|||
{
|
||||
if (!animation) return;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
efl_animation_target_set(animation, target);
|
||||
|
||||
double duration = efl_animation_duration_get(eo_obj);
|
||||
double duration = efl_animation_duration_get(efl_super(eo_obj, MY_CLASS));
|
||||
/* if group animation duration is available value, then the duration is
|
||||
* propagated to its child. */
|
||||
if (duration != EFL_ANIMATION_GROUP_DURATION_NONE)
|
||||
|
@ -21,6 +17,7 @@ _efl_animation_group_animation_add(Eo *eo_obj,
|
|||
efl_animation_final_state_keep_set(animation, keep_final_state);
|
||||
|
||||
pd->animations = eina_list_append(pd->animations, animation);
|
||||
efl_ref(animation);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -28,9 +25,19 @@ _efl_animation_group_animation_del(Eo *eo_obj EINA_UNUSED,
|
|||
Efl_Animation_Group_Data *pd,
|
||||
Efl_Animation*animation)
|
||||
{
|
||||
Eina_List *list;
|
||||
if (!animation) return;
|
||||
|
||||
pd->animations = eina_list_remove(pd->animations, animation);
|
||||
list = eina_list_data_find_list(pd->animations, animation);
|
||||
if (list)
|
||||
{
|
||||
pd->animations = eina_list_remove_list(pd->animations, list);
|
||||
efl_unref(animation);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Animation(%p) is not in the group animation.");
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static Eina_List *
|
||||
|
@ -40,21 +47,6 @@ _efl_animation_group_animations_get(Eo *eo_obj EINA_UNUSED,
|
|||
return pd->animations;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_group_efl_animation_target_set(Eo *eo_obj,
|
||||
Efl_Animation_Group_Data *pd,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
Eina_List *l;
|
||||
Efl_Animation *anim;
|
||||
EINA_LIST_FOREACH(pd->animations, l, anim)
|
||||
{
|
||||
efl_animation_target_set(anim, target);
|
||||
}
|
||||
|
||||
efl_animation_target_set(efl_super(eo_obj, MY_CLASS), target);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_group_efl_animation_duration_set(Eo *eo_obj,
|
||||
Efl_Animation_Group_Data *pd,
|
||||
|
@ -114,8 +106,7 @@ _efl_animation_group_efl_object_constructor(Eo *eo_obj,
|
|||
pd->animations = NULL;
|
||||
|
||||
//group animation does not affect its child duration by default.
|
||||
efl_animation_duration_set(efl_super(eo_obj, MY_CLASS),
|
||||
EFL_ANIMATION_GROUP_DURATION_NONE);
|
||||
efl_animation_duration_set(eo_obj, EFL_ANIMATION_GROUP_DURATION_NONE);
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
@ -126,8 +117,8 @@ _efl_animation_group_efl_object_destructor(Eo *eo_obj,
|
|||
{
|
||||
Efl_Animation *anim;
|
||||
|
||||
EINA_LIST_FREE(pd->animations, anim)
|
||||
efl_del(anim);
|
||||
EINA_LIST_FREE(pd->animations, anim);
|
||||
efl_unref(anim);
|
||||
|
||||
efl_destructor(efl_super(eo_obj, MY_CLASS));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ abstract Efl.Animation.Group (Efl.Animation)
|
|||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
Efl.Animation.target { set; }
|
||||
Efl.Animation.duration { set; }
|
||||
Efl.Animation.final_state_keep { set; }
|
||||
Efl.Animation.interpolator { set; }
|
||||
|
|
|
@ -1,98 +1,77 @@
|
|||
#include "efl_animation_group_parallel_private.h"
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_group_parallel_efl_animation_group_animation_add(Eo *eo_obj,
|
||||
Efl_Animation_Group_Parallel_Data *pd EINA_UNUSED,
|
||||
Efl_Animation *animation)
|
||||
#define MY_CLASS EFL_ANIMATION_GROUP_PARALLEL_CLASS
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_group_parallel_efl_animation_animation_apply(Eo *eo_obj,
|
||||
void *_pd EINA_UNUSED,
|
||||
double progress,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
if (!animation) return;
|
||||
double group_length, group_elapsed_time;
|
||||
double anim_length, anim_duration, anim_start_delay, anim_progress, anim_elapsed_time;
|
||||
int anim_repeated_count;
|
||||
|
||||
efl_animation_group_animation_add(efl_super(eo_obj, MY_CLASS),
|
||||
animation);
|
||||
}
|
||||
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
|
||||
Eina_List *group_anim = efl_animation_group_animations_get(eo_obj);
|
||||
if (!group_anim) return progress;
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_group_parallel_efl_animation_group_animation_del(Eo *eo_obj,
|
||||
Efl_Animation_Group_Parallel_Data *pd EINA_UNUSED,
|
||||
Efl_Animation *animation)
|
||||
{
|
||||
if (!animation) return;
|
||||
group_length = efl_playable_length_get(eo_obj);
|
||||
group_elapsed_time = group_length * progress;
|
||||
|
||||
efl_animation_group_animation_del(efl_super(eo_obj, MY_CLASS),
|
||||
animation);
|
||||
Eina_List *l;
|
||||
Efl_Animation *anim;
|
||||
EINA_LIST_FOREACH(group_anim, l, anim)
|
||||
{
|
||||
anim_length = efl_playable_length_get(anim);
|
||||
anim_duration = efl_animation_duration_get(anim);
|
||||
anim_start_delay = efl_animation_start_delay_get(anim);
|
||||
|
||||
anim_repeated_count = (int)(group_elapsed_time / anim_length);
|
||||
|
||||
if ((anim_length + anim_start_delay) <= group_elapsed_time)
|
||||
{
|
||||
if (efl_animation_final_state_keep_get(anim) && (!FINAL_STATE_IS_REVERSE(anim)))
|
||||
anim_progress = 1.0;
|
||||
else
|
||||
anim_progress = 0.0;
|
||||
efl_animation_apply(anim, anim_progress, target);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
anim_elapsed_time =
|
||||
MAX(((group_elapsed_time - (anim_length * anim_repeated_count)) - anim_start_delay), 0.0);
|
||||
anim_progress = MIN((anim_elapsed_time / anim_duration), 1.0);
|
||||
if (FINAL_STATE_IS_REVERSE(anim))
|
||||
anim_progress = 1.0 - anim_progress;
|
||||
|
||||
efl_animation_apply(anim, anim_progress, target);
|
||||
}
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_group_parallel_efl_animation_total_duration_get(Eo *eo_obj,
|
||||
Efl_Animation_Group_Parallel_Data *pd EINA_UNUSED)
|
||||
_efl_animation_group_parallel_efl_animation_duration_get(Eo *eo_obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
Eina_List *animations =
|
||||
efl_animation_group_animations_get(eo_obj);
|
||||
double child_total_duration;
|
||||
double total_duration = 0.0;
|
||||
|
||||
Eina_List *animations = efl_animation_group_animations_get(eo_obj);
|
||||
if (!animations) return 0.0;
|
||||
|
||||
double total_duration = 0.0;
|
||||
Eina_List *l;
|
||||
Efl_Animation *anim;
|
||||
EINA_LIST_FOREACH(animations, l, anim)
|
||||
{
|
||||
double child_total_duration = efl_animation_total_duration_get(anim);
|
||||
|
||||
double start_delay = efl_animation_start_delay_get(anim);
|
||||
if (start_delay > 0.0)
|
||||
child_total_duration += start_delay;
|
||||
|
||||
int child_repeat_count = efl_animation_repeat_count_get(anim);
|
||||
if (child_repeat_count > 0)
|
||||
child_total_duration *= (child_repeat_count + 1);
|
||||
|
||||
child_total_duration = efl_playable_length_get(anim);
|
||||
child_total_duration += efl_animation_start_delay_get(anim);
|
||||
if (child_total_duration > total_duration)
|
||||
total_duration = child_total_duration;
|
||||
}
|
||||
|
||||
return total_duration;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Animation_Object *
|
||||
_efl_animation_group_parallel_efl_animation_object_create(Eo *eo_obj,
|
||||
Efl_Animation_Group_Parallel_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Efl_Animation_Object_Group_Parallel *group_anim_obj
|
||||
= efl_add(EFL_ANIMATION_OBJECT_GROUP_PARALLEL_CLASS, NULL);
|
||||
|
||||
Eina_List *animations = efl_animation_group_animations_get(eo_obj);
|
||||
Eina_List *l;
|
||||
Efl_Animation *child_anim;
|
||||
Efl_Animation_Object *child_anim_obj;
|
||||
|
||||
EINA_LIST_FOREACH(animations, l, child_anim)
|
||||
{
|
||||
child_anim_obj = efl_animation_object_create(child_anim);
|
||||
efl_animation_object_group_object_add(group_anim_obj, child_anim_obj);
|
||||
}
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
efl_animation_object_target_set(group_anim_obj, target);
|
||||
|
||||
Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
|
||||
efl_animation_object_final_state_keep_set(group_anim_obj, state_keep);
|
||||
|
||||
double duration = efl_animation_duration_get(eo_obj);
|
||||
efl_animation_object_duration_set(group_anim_obj, duration);
|
||||
|
||||
double start_delay_time = efl_animation_start_delay_get(eo_obj);
|
||||
efl_animation_object_start_delay_set(group_anim_obj, start_delay_time);
|
||||
|
||||
Efl_Animation_Object_Repeat_Mode repeat_mode =
|
||||
(Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
|
||||
efl_animation_object_repeat_mode_set(group_anim_obj, repeat_mode);
|
||||
|
||||
int repeat_count = efl_animation_repeat_count_get(eo_obj);
|
||||
efl_animation_object_repeat_count_set(group_anim_obj, repeat_count);
|
||||
|
||||
Efl_Interpolator *interpolator = efl_animation_interpolator_get(eo_obj);
|
||||
efl_animation_object_interpolator_set(group_anim_obj, interpolator);
|
||||
|
||||
return group_anim_obj;
|
||||
}
|
||||
|
||||
#include "efl_animation_group_parallel.eo.c"
|
||||
|
|
|
@ -3,13 +3,11 @@ import efl_animation_types;
|
|||
class Efl.Animation.Group.Parallel (Efl.Animation.Group)
|
||||
{
|
||||
[[Efl group parallel animation class]]
|
||||
data: Efl_Animation_Group_Parallel_Data;
|
||||
data: null;
|
||||
methods {
|
||||
}
|
||||
implements {
|
||||
Efl.Animation.object_create;
|
||||
Efl.Animation.Group.animation_add;
|
||||
Efl.Animation.Group.animation_del;
|
||||
Efl.Animation.total_duration { get; }
|
||||
Efl.Animation.duration { get; }
|
||||
Efl.Animation.animation_apply;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,4 @@
|
|||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_GROUP_PARALLEL_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_GROUP_PARALLEL_DATA_GET(o, pd) \
|
||||
Efl_Animation_Group_Parallel_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_GROUP_PARALLEL_CLASS)
|
||||
|
||||
typedef struct _Efl_Animation_Group_Parallel_Data
|
||||
{
|
||||
} Efl_Animation_Group_Parallel_Data;
|
||||
#include "efl_animation_private.h"
|
||||
|
|
|
@ -1,94 +1,81 @@
|
|||
#include "efl_animation_group_sequential_private.h"
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_group_sequential_efl_animation_group_animation_add(Eo *eo_obj,
|
||||
Efl_Animation_Group_Sequential_Data *pd EINA_UNUSED,
|
||||
Efl_Animation *animation)
|
||||
#define MY_CLASS EFL_ANIMATION_GROUP_SEQUENTIAL_CLASS
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_group_sequential_efl_animation_animation_apply(Eo *eo_obj,
|
||||
void *_pd EINA_UNUSED,
|
||||
double progress,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
if (!animation) return;
|
||||
double group_length, group_elapsed_time;
|
||||
double anim_length, anim_duration, anim_start_delay, anim_progress, anim_play_time, anim_position;
|
||||
double total_anim_elapsed_time = 0.0;
|
||||
double temp;
|
||||
int anim_repeated_count;
|
||||
|
||||
efl_animation_group_animation_add(efl_super(eo_obj, MY_CLASS), animation);
|
||||
}
|
||||
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
|
||||
Eina_List *group_anim = efl_animation_group_animations_get(eo_obj);
|
||||
if (!group_anim) return progress;
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_group_sequential_efl_animation_group_animation_del(Eo *eo_obj,
|
||||
Efl_Animation_Group_Sequential_Data *pd EINA_UNUSED,
|
||||
Efl_Animation *animation)
|
||||
{
|
||||
if (!animation) return;
|
||||
group_length = efl_playable_length_get(eo_obj);
|
||||
group_elapsed_time = group_length * progress;
|
||||
|
||||
efl_animation_group_animation_del(efl_super(eo_obj, MY_CLASS), animation);
|
||||
Eina_List *l;
|
||||
Efl_Animation *anim;
|
||||
EINA_LIST_FOREACH(group_anim, l, anim)
|
||||
{
|
||||
anim_start_delay = efl_animation_start_delay_get(anim);
|
||||
anim_length = efl_playable_length_get(anim) + anim_start_delay;
|
||||
anim_duration = efl_animation_duration_get(anim);
|
||||
|
||||
//Check whether this animation is playing.
|
||||
temp = total_anim_elapsed_time + anim_length + anim_start_delay;
|
||||
if (temp <= group_elapsed_time)
|
||||
{
|
||||
if (efl_animation_final_state_keep_get(anim) && (!FINAL_STATE_IS_REVERSE(anim)))
|
||||
anim_progress = 1.0;
|
||||
else
|
||||
anim_progress = 0.0;
|
||||
efl_animation_apply(anim, anim_progress, target);
|
||||
total_anim_elapsed_time = temp;
|
||||
continue;
|
||||
}
|
||||
|
||||
anim_play_time = group_elapsed_time - total_anim_elapsed_time - anim_start_delay;
|
||||
//TODO: check infinite repeat
|
||||
anim_repeated_count = (int)(anim_play_time / anim_length);
|
||||
anim_position = MAX(((anim_play_time - anim_duration * anim_repeated_count)), 0.0);
|
||||
anim_progress = MIN((anim_position / anim_duration), 1.0);
|
||||
if (FINAL_STATE_IS_REVERSE(anim))
|
||||
anim_progress = 1.0 - anim_progress;
|
||||
efl_animation_apply(anim, anim_progress, target);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_group_sequential_efl_animation_total_duration_get(Eo *eo_obj,
|
||||
Efl_Animation_Group_Sequential_Data *pd EINA_UNUSED)
|
||||
_efl_animation_group_sequential_efl_animation_duration_get(Eo *eo_obj, void *_pd EINA_UNUSED)
|
||||
{
|
||||
double total_duration = 0.0;
|
||||
double child_total_duration;
|
||||
|
||||
Eina_List *animations = efl_animation_group_animations_get(eo_obj);
|
||||
if (!animations) return 0.0;
|
||||
|
||||
double total_duration = 0.0;
|
||||
Eina_List *l;
|
||||
Efl_Animation *anim;
|
||||
EINA_LIST_FOREACH(animations, l, anim)
|
||||
{
|
||||
double child_total_duration = efl_animation_total_duration_get(anim);
|
||||
|
||||
double start_delay = efl_animation_start_delay_get(anim);
|
||||
if (start_delay > 0.0)
|
||||
child_total_duration += start_delay;
|
||||
|
||||
int child_repeat_count = efl_animation_repeat_count_get(anim);
|
||||
if (child_repeat_count > 0)
|
||||
child_total_duration *= (child_repeat_count + 1);
|
||||
|
||||
child_total_duration = efl_playable_length_get(anim);
|
||||
child_total_duration += efl_animation_start_delay_get(anim);
|
||||
total_duration += child_total_duration;
|
||||
}
|
||||
|
||||
return total_duration;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Animation_Object *
|
||||
_efl_animation_group_sequential_efl_animation_object_create(Eo *eo_obj,
|
||||
Efl_Animation_Group_Sequential_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Efl_Animation_Object_Group_Sequential *group_anim_obj
|
||||
= efl_add(EFL_ANIMATION_OBJECT_GROUP_SEQUENTIAL_CLASS, NULL);
|
||||
|
||||
Eina_List *animations = efl_animation_group_animations_get(eo_obj);
|
||||
Eina_List *l;
|
||||
Efl_Animation *child_anim;
|
||||
Efl_Animation_Object *child_anim_obj;
|
||||
|
||||
EINA_LIST_FOREACH(animations, l, child_anim)
|
||||
{
|
||||
child_anim_obj = efl_animation_object_create(child_anim);
|
||||
efl_animation_object_group_object_add(group_anim_obj, child_anim_obj);
|
||||
}
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
efl_animation_object_target_set(group_anim_obj, target);
|
||||
|
||||
Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
|
||||
efl_animation_object_final_state_keep_set(group_anim_obj, state_keep);
|
||||
|
||||
double duration = efl_animation_duration_get(eo_obj);
|
||||
efl_animation_object_duration_set(group_anim_obj, duration);
|
||||
|
||||
double start_delay_time = efl_animation_start_delay_get(eo_obj);
|
||||
efl_animation_object_start_delay_set(group_anim_obj, start_delay_time);
|
||||
|
||||
Efl_Animation_Object_Repeat_Mode repeat_mode =
|
||||
(Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
|
||||
efl_animation_object_repeat_mode_set(group_anim_obj, repeat_mode);
|
||||
|
||||
int repeat_count = efl_animation_repeat_count_get(eo_obj);
|
||||
efl_animation_object_repeat_count_set(group_anim_obj, repeat_count);
|
||||
|
||||
Efl_Interpolator *interpolator = efl_animation_interpolator_get(eo_obj);
|
||||
efl_animation_object_interpolator_set(group_anim_obj, interpolator);
|
||||
|
||||
return group_anim_obj;
|
||||
}
|
||||
|
||||
#include "efl_animation_group_sequential.eo.c"
|
||||
|
|
|
@ -3,13 +3,11 @@ import efl_animation_types;
|
|||
class Efl.Animation.Group.Sequential (Efl.Animation.Group)
|
||||
{
|
||||
[[Efl group sequential animation class]]
|
||||
data: Efl_Animation_Group_Sequential_Data;
|
||||
data: null;
|
||||
methods {
|
||||
}
|
||||
implements {
|
||||
Efl.Animation.object_create;
|
||||
Efl.Animation.Group.animation_add;
|
||||
Efl.Animation.Group.animation_del;
|
||||
Efl.Animation.total_duration { get; }
|
||||
Efl.Animation.duration { get; }
|
||||
Efl.Animation.animation_apply;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,4 @@
|
|||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_GROUP_SEQUENTIAL_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_GROUP_SEQUENTIAL_DATA_GET(o, pd) \
|
||||
Efl_Animation_Group_Sequential_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_GROUP_SEQUENTIAL_CLASS)
|
||||
|
||||
typedef struct _Efl_Animation_Group_Sequential_Data
|
||||
{
|
||||
} Efl_Animation_Group_Sequential_Data;
|
||||
#include "efl_animation_private.h"
|
||||
|
|
|
@ -1,585 +0,0 @@
|
|||
#include "efl_animation_object_private.h"
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_auto_del_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd,
|
||||
Eina_Bool auto_del)
|
||||
{
|
||||
pd->auto_del = auto_del;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_animation_object_auto_del_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
return pd->auto_del;
|
||||
}
|
||||
|
||||
static void
|
||||
_target_del_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
Eo *eo_obj = data;
|
||||
|
||||
EFL_ANIMATION_OBJECT_DATA_GET(eo_obj, pd);
|
||||
|
||||
pd->target = NULL;
|
||||
efl_animation_object_cancel(eo_obj);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_target_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Data *pd,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
if (pd->target == target) return;
|
||||
|
||||
if (pd->target)
|
||||
efl_event_callback_del(pd->target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
|
||||
|
||||
efl_event_callback_add(target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
|
||||
|
||||
pd->target = target;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Canvas_Object *
|
||||
_efl_animation_object_target_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
return pd->target;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_duration_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd,
|
||||
double duration)
|
||||
{
|
||||
pd->duration = duration;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_object_duration_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
return pd->duration;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_object_total_duration_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
return pd->duration;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_repeat_mode_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd,
|
||||
Efl_Animation_Object_Repeat_Mode mode)
|
||||
{
|
||||
if ((mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_RESTART) ||
|
||||
(mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE))
|
||||
pd->repeat_mode = mode;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Animation_Object_Repeat_Mode
|
||||
_efl_animation_object_repeat_mode_get(const Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
return pd->repeat_mode;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_repeat_count_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd,
|
||||
int count)
|
||||
{
|
||||
//EFL_ANIMATION_OBJECT_REPEAT_INFINITE repeats animation infinitely
|
||||
if ((count < 0) && (count != EFL_ANIMATION_OBJECT_REPEAT_INFINITE)) return;
|
||||
|
||||
pd->repeat_count = count;
|
||||
}
|
||||
|
||||
EOLIAN static int
|
||||
_efl_animation_object_repeat_count_get(const Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
return pd->repeat_count;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_start_delay_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd,
|
||||
double delay_time)
|
||||
{
|
||||
if (delay_time < 0.0) return;
|
||||
|
||||
pd->start_delay_time = delay_time;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_object_start_delay_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
return pd->start_delay_time;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_interpolator_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd,
|
||||
Efl_Interpolator *interpolator)
|
||||
{
|
||||
pd->interpolator = interpolator;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Interpolator *
|
||||
_efl_animation_object_interpolator_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
return pd->interpolator;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_target_state_save(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
if (!pd->target || !pd->target_state) return;
|
||||
|
||||
Evas_Coord x, y, w, h;
|
||||
evas_object_geometry_get(pd->target, &x, &y, &w, &h);
|
||||
|
||||
pd->target_state->x = x;
|
||||
pd->target_state->y = y;
|
||||
pd->target_state->w = w;
|
||||
pd->target_state->h = h;
|
||||
|
||||
int r, g, b, a;
|
||||
evas_object_color_get(pd->target, &r, &g, &b, &a);
|
||||
|
||||
pd->target_state->r = r;
|
||||
pd->target_state->g = g;
|
||||
pd->target_state->b = b;
|
||||
pd->target_state->a = a;
|
||||
|
||||
Evas_Map *map = evas_map_dup(evas_object_map_get(pd->target));
|
||||
pd->target_state->map = map;
|
||||
|
||||
Eina_Bool enable_map = evas_object_map_enable_get(pd->target);
|
||||
pd->target_state->enable_map = enable_map;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_target_state_reset(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
if (!pd->target) return;
|
||||
|
||||
if (efl_gfx_map_has(pd->target))
|
||||
efl_gfx_map_reset(pd->target);
|
||||
|
||||
if (!pd->target_state) return;
|
||||
|
||||
Evas_Coord x, y, w, h;
|
||||
x = pd->target_state->x;
|
||||
y = pd->target_state->y;
|
||||
w = pd->target_state->w;
|
||||
h = pd->target_state->h;
|
||||
|
||||
evas_object_resize(pd->target, w, h);
|
||||
evas_object_move(pd->target, x, y);
|
||||
|
||||
int r, g, b, a;
|
||||
r = pd->target_state->r;
|
||||
g = pd->target_state->g;
|
||||
b = pd->target_state->b;
|
||||
a = pd->target_state->a;
|
||||
|
||||
evas_object_color_set(pd->target, r, g, b, a);
|
||||
|
||||
Evas_Map *map = pd->target_state->map;
|
||||
evas_object_map_set(pd->target, map);
|
||||
|
||||
Eina_Bool enable_map = pd->target_state->enable_map;
|
||||
evas_object_map_enable_set(pd->target, enable_map);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_target_map_reset(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
if (!pd->target) return;
|
||||
|
||||
if (efl_gfx_map_has(pd->target))
|
||||
efl_gfx_map_reset(pd->target);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_final_state_keep_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd,
|
||||
Eina_Bool keep_final_state)
|
||||
{
|
||||
if (pd->keep_final_state == keep_final_state) return;
|
||||
|
||||
pd->keep_final_state = !!keep_final_state;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_animation_object_final_state_keep_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
return pd->keep_final_state;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_animator_cb(void *data)
|
||||
{
|
||||
Eo *eo_obj = data;
|
||||
EFL_ANIMATION_OBJECT_DATA_GET(eo_obj, pd);
|
||||
|
||||
if (pd->is_paused)
|
||||
{
|
||||
pd->animator = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
if (pd->is_cancelled) goto end;
|
||||
|
||||
double paused_time = pd->paused_time;
|
||||
|
||||
double total_duration = efl_animation_object_total_duration_get(eo_obj);
|
||||
|
||||
pd->time.current = ecore_loop_time_get();
|
||||
double elapsed_time = pd->time.current - pd->time.begin;
|
||||
|
||||
if ((elapsed_time - paused_time) > total_duration)
|
||||
elapsed_time = total_duration + paused_time;
|
||||
|
||||
if (total_duration < 0.0) goto end;
|
||||
|
||||
if (total_duration == 0.0)
|
||||
{
|
||||
ecore_animator_del(pd->animator);
|
||||
pd->animator = NULL;
|
||||
|
||||
pd->progress = 1.0;
|
||||
}
|
||||
else
|
||||
pd->progress = (elapsed_time - paused_time) / total_duration;
|
||||
|
||||
if (!pd->is_direction_forward)
|
||||
pd->progress = 1.0 - pd->progress;
|
||||
|
||||
//If the direction is changed, then reset the target state.
|
||||
if (pd->is_direction_changed)
|
||||
{
|
||||
pd->is_direction_changed = EINA_FALSE;
|
||||
efl_animation_object_target_state_reset(eo_obj);
|
||||
}
|
||||
|
||||
//Apply interpolator
|
||||
if (pd->interpolator)
|
||||
{
|
||||
pd->progress = efl_interpolator_interpolate(pd->interpolator,
|
||||
pd->progress);
|
||||
}
|
||||
|
||||
//Reset previous animation effect before applying animation effect
|
||||
/* FIXME: When the target state is saved, it may not be finished to calculate
|
||||
* target geometry.
|
||||
* In this case, incorrect geometry is saved and the target moves to the
|
||||
* incorrect position when animation is paused and resumed.
|
||||
* As a result, flicking issue happens.
|
||||
* To avoid the flicking issue, reset map only during animation. */
|
||||
efl_animation_object_target_map_reset(eo_obj);
|
||||
|
||||
efl_animation_object_progress_set(eo_obj, pd->progress);
|
||||
|
||||
//Not end. Keep going.
|
||||
if ((elapsed_time - paused_time) < total_duration)
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
||||
end:
|
||||
//Repeat animation
|
||||
if ((pd->repeat_count == EFL_ANIMATION_OBJECT_REPEAT_INFINITE) ||
|
||||
(pd->remaining_repeat_count > 0))
|
||||
{
|
||||
if (pd->remaining_repeat_count > 0)
|
||||
pd->remaining_repeat_count--;
|
||||
|
||||
pd->time.begin = ecore_loop_time_get();
|
||||
pd->paused_time = 0.0;
|
||||
|
||||
if (pd->repeat_mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE)
|
||||
{
|
||||
pd->is_direction_forward = !pd->is_direction_forward;
|
||||
pd->is_direction_changed = EINA_TRUE;
|
||||
}
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
pd->is_ended = EINA_TRUE;
|
||||
pd->animator = NULL;
|
||||
|
||||
//Reset the state of the target to the initial state
|
||||
if (!pd->keep_final_state)
|
||||
efl_animation_object_target_state_reset(eo_obj);
|
||||
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, NULL);
|
||||
|
||||
if (pd->auto_del) efl_del(eo_obj);
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
static void
|
||||
_start(Eo *eo_obj, Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
double total_duration = efl_animation_object_total_duration_get(eo_obj);
|
||||
if (total_duration < 0.0) return;
|
||||
|
||||
//Save the current state of the target
|
||||
efl_animation_object_target_state_save(eo_obj);
|
||||
|
||||
pd->is_started = EINA_TRUE;
|
||||
pd->is_cancelled = EINA_FALSE;
|
||||
pd->is_ended = EINA_FALSE;
|
||||
pd->is_direction_forward = EINA_TRUE;
|
||||
pd->is_direction_changed = EINA_FALSE;
|
||||
|
||||
pd->paused_time = 0.0;
|
||||
|
||||
pd->remaining_repeat_count = pd->repeat_count;
|
||||
|
||||
ecore_animator_del(pd->animator);
|
||||
pd->animator = NULL;
|
||||
|
||||
pd->time.begin = ecore_loop_time_get();
|
||||
|
||||
//pre started event is supported within class only (protected event)
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_OBJECT_EVENT_PRE_STARTED,
|
||||
NULL);
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, NULL);
|
||||
|
||||
pd->animator = ecore_animator_add(_animator_cb, eo_obj);
|
||||
|
||||
_animator_cb(eo_obj);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_start_delay_timer_cb(void *data)
|
||||
{
|
||||
Eo *eo_obj = data;
|
||||
EFL_ANIMATION_OBJECT_DATA_GET(eo_obj, pd);
|
||||
|
||||
pd->start_delay_timer = NULL;
|
||||
|
||||
_start(eo_obj, pd);
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_start(Eo *eo_obj,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
if (pd->start_delay_timer) return;
|
||||
|
||||
if (pd->start_delay_time > 0.0)
|
||||
{
|
||||
pd->start_delay_timer = ecore_timer_add(pd->start_delay_time,
|
||||
_start_delay_timer_cb, eo_obj);
|
||||
return;
|
||||
}
|
||||
|
||||
_start(eo_obj, pd);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_cancel(Eo *eo_obj,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
ecore_timer_del(pd->start_delay_timer);
|
||||
pd->start_delay_timer = NULL;
|
||||
|
||||
pd->is_cancelled = EINA_TRUE;
|
||||
pd->is_ended = EINA_TRUE;
|
||||
|
||||
if (pd->animator)
|
||||
{
|
||||
ecore_animator_del(pd->animator);
|
||||
pd->animator = NULL;
|
||||
|
||||
//Reset the state of the target to the initial state
|
||||
if (!pd->keep_final_state)
|
||||
efl_animation_object_target_state_reset(eo_obj);
|
||||
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, NULL);
|
||||
}
|
||||
|
||||
if (pd->auto_del) efl_del(eo_obj);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_progress_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0)) return;
|
||||
|
||||
if (!pd->is_direction_forward)
|
||||
pd->progress = 1.0 - pd->progress;
|
||||
|
||||
//Apply interpolator
|
||||
if (pd->interpolator)
|
||||
{
|
||||
pd->progress = efl_interpolator_interpolate(pd->interpolator,
|
||||
pd->progress);
|
||||
}
|
||||
|
||||
Efl_Animation_Object_Running_Event_Info event_info;
|
||||
event_info.progress = progress;
|
||||
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING,
|
||||
&event_info);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_pause(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
if (!pd->is_started) return;
|
||||
if (pd->is_ended) return;
|
||||
if (pd->is_paused) return;
|
||||
|
||||
pd->is_paused = EINA_TRUE;
|
||||
|
||||
if (pd->start_delay_timer) return;
|
||||
|
||||
ecore_animator_del(pd->animator);
|
||||
pd->animator = NULL;
|
||||
|
||||
pd->time.pause_begin = ecore_loop_time_get();
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_resume(Eo *eo_obj,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
if (!pd->is_started) return;
|
||||
if (pd->is_ended) return;
|
||||
if (!pd->is_paused) return;
|
||||
|
||||
pd->is_paused = EINA_FALSE;
|
||||
|
||||
if (pd->start_delay_timer) return;
|
||||
|
||||
pd->paused_time += (ecore_loop_time_get() - pd->time.pause_begin);
|
||||
|
||||
pd->animator = ecore_animator_add(_animator_cb, eo_obj);
|
||||
|
||||
_animator_cb(eo_obj);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_animation_object_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->time.begin = 0.0;
|
||||
pd->time.current = 0.0;
|
||||
|
||||
pd->target = NULL;
|
||||
pd->target_state = (Target_State *) calloc(1, sizeof(Target_State));
|
||||
|
||||
pd->progress = 0.0;
|
||||
|
||||
pd->duration = 0.0;
|
||||
|
||||
pd->repeat_mode = EFL_ANIMATION_OBJECT_REPEAT_MODE_RESTART;
|
||||
pd->repeat_count = 0;
|
||||
|
||||
pd->auto_del = EINA_TRUE;
|
||||
pd->is_cancelled = EINA_FALSE;
|
||||
pd->keep_final_state = EINA_FALSE;
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_efl_object_destructor(Eo *eo_obj,
|
||||
Efl_Animation_Object_Data *pd)
|
||||
{
|
||||
if (pd->animator)
|
||||
{
|
||||
ecore_animator_del(pd->animator);
|
||||
pd->animator = NULL;
|
||||
|
||||
//Reset the state of the target to the initial state
|
||||
if (!pd->keep_final_state)
|
||||
efl_animation_object_target_state_reset(eo_obj);
|
||||
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, NULL);
|
||||
}
|
||||
|
||||
if (pd->target)
|
||||
efl_event_callback_del(pd->target, EFL_EVENT_DEL, _target_del_cb, eo_obj);
|
||||
|
||||
free(pd->target_state);
|
||||
pd->target_state = NULL;
|
||||
|
||||
efl_destructor(efl_super(eo_obj, MY_CLASS));
|
||||
}
|
||||
|
||||
/* Internal EO APIs */
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_target_set, EFL_FUNC_CALL(target), Efl_Canvas_Object *target);
|
||||
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_target_get, Efl_Canvas_Object *, NULL);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_final_state_keep_set, EFL_FUNC_CALL(state_keep), Eina_Bool state_keep);
|
||||
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_final_state_keep_get, Eina_Bool, 0);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_duration_set, EFL_FUNC_CALL(duration), double duration);
|
||||
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_duration_get, double, 0);
|
||||
|
||||
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_total_duration_get, double, 0);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_start_delay_set, EFL_FUNC_CALL(delay_time), double delay_time);
|
||||
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_start_delay_get, double, 0);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_repeat_mode_set, EFL_FUNC_CALL(mode), Efl_Animation_Object_Repeat_Mode mode);
|
||||
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_repeat_mode_get, Efl_Animation_Object_Repeat_Mode, 0);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_repeat_count_set, EFL_FUNC_CALL(count), int count);
|
||||
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_repeat_count_get, int, 0);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_interpolator_set, EFL_FUNC_CALL(interpolator), Efl_Interpolator *interpolator);
|
||||
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_interpolator_get, Efl_Interpolator *, NULL);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODY(efl_animation_object_target_state_save);
|
||||
EOAPI EFL_VOID_FUNC_BODY(efl_animation_object_target_state_reset);
|
||||
EOAPI EFL_VOID_FUNC_BODY(efl_animation_object_target_map_reset);
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_EXTRA_OPS \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_target_set, _efl_animation_object_target_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_target_get, _efl_animation_object_target_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_final_state_keep_set, _efl_animation_object_final_state_keep_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_final_state_keep_get, _efl_animation_object_final_state_keep_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_duration_set, _efl_animation_object_duration_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_duration_get, _efl_animation_object_duration_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_total_duration_get, _efl_animation_object_total_duration_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_start_delay_set, _efl_animation_object_start_delay_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_start_delay_get, _efl_animation_object_start_delay_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_mode_set, _efl_animation_object_repeat_mode_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_mode_get, _efl_animation_object_repeat_mode_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_count_set, _efl_animation_object_repeat_count_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_count_get, _efl_animation_object_repeat_count_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_interpolator_set, _efl_animation_object_interpolator_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_interpolator_get, _efl_animation_object_interpolator_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_target_state_save, _efl_animation_object_target_state_save), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_target_state_reset, _efl_animation_object_target_state_reset), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_target_map_reset, _efl_animation_object_target_map_reset)
|
||||
|
||||
EWAPI const Efl_Event_Description _EFL_ANIMATION_OBJECT_EVENT_PRE_STARTED =
|
||||
EFL_EVENT_DESCRIPTION("pre_started");
|
||||
|
||||
#include "efl_animation_object.eo.c"
|
|
@ -1,46 +0,0 @@
|
|||
import efl_animation_types;
|
||||
|
||||
class Efl.Animation.Object (Efl.Object)
|
||||
{
|
||||
[[Efl animation object class]]
|
||||
data: Efl_Animation_Object_Data;
|
||||
methods {
|
||||
@property auto_del {
|
||||
[[Auto delete property]]
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
auto_del: bool; [[$true to delete animation object automatically when animation is finished or animation is cancelled, $false otherwise.]]
|
||||
}
|
||||
}
|
||||
start {
|
||||
[[Start animation.]]
|
||||
}
|
||||
cancel {
|
||||
[[Cancel animation.]]
|
||||
}
|
||||
pause {
|
||||
[[Pause animation.]]
|
||||
}
|
||||
resume {
|
||||
[[Resume animation.]]
|
||||
}
|
||||
progress_set @protected {
|
||||
[[Display the moment of animation according to the given progress.]]
|
||||
params {
|
||||
@in progress: double; [[The value between 0.0 and 1.0 which indicates the progress of the animation]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
}
|
||||
events {
|
||||
started; [[Animation is started.]]
|
||||
running; [[Animation is running.]]
|
||||
ended; [[Animation is ended.]]
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
#include "efl_animation_object_alpha_private.h"
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_alpha_alpha_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Alpha_Data *pd,
|
||||
double from_alpha,
|
||||
double to_alpha)
|
||||
{
|
||||
pd->from.alpha = from_alpha;
|
||||
pd->to.alpha = to_alpha;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_alpha_alpha_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Alpha_Data *pd,
|
||||
double *from_alpha,
|
||||
double *to_alpha)
|
||||
{
|
||||
if (from_alpha)
|
||||
*from_alpha = pd->from.alpha;
|
||||
if (to_alpha)
|
||||
*to_alpha = pd->to.alpha;
|
||||
}
|
||||
|
||||
static void
|
||||
_progress_set(Eo *eo_obj, double progress)
|
||||
{
|
||||
EFL_ANIMATION_OBJECT_ALPHA_DATA_GET(eo_obj, pd);
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (!target) return;
|
||||
|
||||
double alpha
|
||||
= (pd->from.alpha * (1.0 - progress)) + (pd->to.alpha * progress);
|
||||
|
||||
int r[4], g[4], b[4], a[4];
|
||||
int i;
|
||||
for (i = 0; i < 4; i++)
|
||||
efl_gfx_map_color_get(target, i, &r[i], &g[i], &b[i], &a[i]);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
r[i] = (int)(r[i] * alpha);
|
||||
g[i] = (int)(g[i] * alpha);
|
||||
b[i] = (int)(b[i] * alpha);
|
||||
a[i] = (int)(a[i] * alpha);
|
||||
efl_gfx_map_color_set(target, i, r[i], g[i], b[i], a[i]);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_alpha_efl_animation_object_progress_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Alpha_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0)) return;
|
||||
|
||||
_progress_set(eo_obj, progress);
|
||||
|
||||
efl_animation_object_progress_set(efl_super(eo_obj, MY_CLASS), progress);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_animation_object_alpha_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Animation_Object_Alpha_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->from.alpha = 1.0;
|
||||
pd->to.alpha = 1.0;
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
/* Internal EO APIs */
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_alpha_set, EFL_FUNC_CALL(from_alpha, to_alpha), double from_alpha, double to_alpha);
|
||||
EOAPI EFL_VOID_FUNC_BODYV_CONST(efl_animation_object_alpha_get, EFL_FUNC_CALL(from_alpha, to_alpha), double *from_alpha, double *to_alpha);
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_ALPHA_EXTRA_OPS \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_alpha_set, _efl_animation_object_alpha_alpha_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_alpha_get, _efl_animation_object_alpha_alpha_get)
|
||||
|
||||
#include "efl_animation_object_alpha.eo.c"
|
|
@ -1,11 +0,0 @@
|
|||
import efl_animation_types;
|
||||
|
||||
class Efl.Animation.Object.Alpha (Efl.Animation.Object)
|
||||
{
|
||||
[[Efl alpha animation object class]]
|
||||
data: Efl_Animation_Object_Alpha_Data;
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Animation.Object.progress_set;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#define EFL_ANIMATION_OBJECT_PROTECTED
|
||||
#define EFL_ANIMATION_OBJECT_ALPHA_PROTECTED
|
||||
|
||||
#include "evas_common_private.h"
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_OBJECT_ALPHA_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_OBJECT_ALPHA_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_ALPHA_DATA_GET(o, pd) \
|
||||
Efl_Animation_Object_Alpha_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_OBJECT_ALPHA_CLASS)
|
||||
|
||||
typedef struct _Efl_Animation_Object_Alpha_Property
|
||||
{
|
||||
double alpha;
|
||||
} Efl_Animation_Object_Alpha_Property;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Alpha_Data
|
||||
{
|
||||
Efl_Animation_Object_Alpha_Property from;
|
||||
Efl_Animation_Object_Alpha_Property to;
|
||||
} Efl_Animation_Object_Alpha_Data;
|
|
@ -1,200 +0,0 @@
|
|||
#include "efl_animation_object_group_private.h"
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_object_add(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Data *pd,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
if (!anim_obj) return;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
efl_animation_object_target_set(anim_obj, target);
|
||||
|
||||
double duration = efl_animation_object_duration_get(eo_obj);
|
||||
/* if group animation object duration is available value, then the duration
|
||||
* is propagated to its child. */
|
||||
if (duration != EFL_ANIMATION_OBJECT_GROUP_DURATION_NONE)
|
||||
efl_animation_object_duration_set(anim_obj, duration);
|
||||
|
||||
Eina_Bool state_keep = efl_animation_object_final_state_keep_get(eo_obj);
|
||||
efl_animation_object_final_state_keep_set(anim_obj, state_keep);
|
||||
|
||||
pd->anim_objs = eina_list_append(pd->anim_objs, anim_obj);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_object_del(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Group_Data *pd,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
if (!anim_obj) return;
|
||||
|
||||
pd->anim_objs = eina_list_remove(pd->anim_objs, anim_obj);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_List *
|
||||
_efl_animation_object_group_objects_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Group_Data *pd)
|
||||
{
|
||||
return pd->anim_objs;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_efl_animation_object_target_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Data *pd,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
Eina_List *l;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
EINA_LIST_FOREACH(pd->anim_objs, l, anim_obj)
|
||||
{
|
||||
efl_animation_object_target_set(anim_obj, target);
|
||||
}
|
||||
|
||||
efl_animation_object_target_set(efl_super(eo_obj, MY_CLASS), target);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_efl_animation_object_duration_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Data *pd,
|
||||
double duration)
|
||||
{
|
||||
if (duration == EFL_ANIMATION_OBJECT_GROUP_DURATION_NONE) goto end;
|
||||
|
||||
if (duration < 0.0) return;
|
||||
|
||||
Eina_List *l;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
EINA_LIST_FOREACH(pd->anim_objs, l, anim_obj)
|
||||
{
|
||||
efl_animation_object_duration_set(anim_obj, duration);
|
||||
}
|
||||
|
||||
end:
|
||||
efl_animation_object_duration_set(efl_super(eo_obj, MY_CLASS), duration);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_efl_animation_object_final_state_keep_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Data *pd,
|
||||
Eina_Bool state_keep)
|
||||
{
|
||||
Eina_List *l;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
EINA_LIST_FOREACH(pd->anim_objs, l, anim_obj)
|
||||
{
|
||||
efl_animation_object_final_state_keep_set(anim_obj, state_keep);
|
||||
}
|
||||
|
||||
efl_animation_object_final_state_keep_set(efl_super(eo_obj, MY_CLASS),
|
||||
state_keep);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_efl_animation_object_interpolator_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Data *pd,
|
||||
Efl_Interpolator *interpolator)
|
||||
{
|
||||
Eina_List *l;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
EINA_LIST_FOREACH(pd->anim_objs, l, anim_obj)
|
||||
{
|
||||
efl_animation_object_interpolator_set(anim_obj, interpolator);
|
||||
}
|
||||
|
||||
efl_animation_object_interpolator_set(efl_super(eo_obj, MY_CLASS),
|
||||
interpolator);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_animation_object_group_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->anim_objs = NULL;
|
||||
|
||||
//group animation object does not affect its child duration by default.
|
||||
efl_animation_object_duration_set(efl_super(eo_obj, MY_CLASS),
|
||||
EFL_ANIMATION_OBJECT_GROUP_DURATION_NONE);
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_efl_object_destructor(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Data *pd)
|
||||
{
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
EINA_LIST_FREE(pd->anim_objs, anim_obj)
|
||||
efl_del(anim_obj);
|
||||
|
||||
efl_destructor(efl_super(eo_obj, MY_CLASS));
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_efl_animation_object_target_state_save(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Group_Data *pd)
|
||||
{
|
||||
Eina_List *l;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
EINA_LIST_FOREACH(pd->anim_objs, l, anim_obj)
|
||||
{
|
||||
efl_animation_object_target_state_save(anim_obj);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_efl_animation_object_target_state_reset(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Group_Data *pd)
|
||||
{
|
||||
Eina_List *l;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
EINA_LIST_FOREACH(pd->anim_objs, l, anim_obj)
|
||||
{
|
||||
efl_animation_object_target_state_reset(anim_obj);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_efl_animation_object_target_map_reset(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Object_Group_Data *pd)
|
||||
{
|
||||
Eina_List *l;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
EINA_LIST_FOREACH(pd->anim_objs, l, anim_obj)
|
||||
{
|
||||
efl_animation_object_target_map_reset(anim_obj);
|
||||
}
|
||||
}
|
||||
|
||||
/* Internal EO APIs */
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_group_object_add, EFL_FUNC_CALL(anim_obj), Efl_Animation_Object *anim_obj);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_group_object_del, EFL_FUNC_CALL(anim_obj), Efl_Animation_Object *anim_obj);
|
||||
|
||||
EOAPI EFL_FUNC_BODY(efl_animation_object_group_objects_get, Eina_List *, NULL);
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_GROUP_EXTRA_OPS \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_group_object_add, _efl_animation_object_group_object_add), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_group_object_del, _efl_animation_object_group_object_del), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_group_objects_get, _efl_animation_object_group_objects_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_target_set, _efl_animation_object_group_efl_animation_object_target_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_duration_set, _efl_animation_object_group_efl_animation_object_duration_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_final_state_keep_set, _efl_animation_object_group_efl_animation_object_final_state_keep_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_interpolator_set, _efl_animation_object_group_efl_animation_object_interpolator_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_target_state_save, _efl_animation_object_group_efl_animation_object_target_state_save), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_target_state_reset, _efl_animation_object_group_efl_animation_object_target_state_reset), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_target_map_reset, _efl_animation_object_group_efl_animation_object_target_map_reset)
|
||||
|
||||
#include "efl_animation_object_group.eo.c"
|
|
@ -1,11 +0,0 @@
|
|||
import efl_animation_types;
|
||||
|
||||
abstract Efl.Animation.Object.Group (Efl.Animation.Object)
|
||||
{
|
||||
[[Efl group animation object abstract class]]
|
||||
data: Efl_Animation_Object_Group_Data;
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
}
|
||||
}
|
|
@ -1,256 +0,0 @@
|
|||
#include "efl_animation_object_group_parallel_private.h"
|
||||
|
||||
/* Add member object data and append the data to the member object data list.
|
||||
* The member object data contains the repeated count of the member object.
|
||||
*/
|
||||
static void
|
||||
_member_anim_obj_data_add(Efl_Animation_Object_Group_Parallel_Data *pd,
|
||||
Efl_Animation_Object *anim_obj,
|
||||
int repeated_count)
|
||||
{
|
||||
Member_Object_Data *member_anim_obj_data =
|
||||
calloc(1, sizeof(Member_Object_Data));
|
||||
|
||||
if (!member_anim_obj_data) return;
|
||||
|
||||
member_anim_obj_data->anim_obj = anim_obj;
|
||||
member_anim_obj_data->repeated_count = repeated_count;
|
||||
|
||||
pd->member_anim_obj_data_list =
|
||||
eina_list_append(pd->member_anim_obj_data_list, member_anim_obj_data);
|
||||
}
|
||||
|
||||
/* Find the member object data which contains the repeated count of the member
|
||||
* object. */
|
||||
static Member_Object_Data *
|
||||
_member_anim_obj_data_find(Efl_Animation_Object_Group_Parallel_Data *pd,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
Eina_List *l;
|
||||
Member_Object_Data *member_anim_obj_data = NULL;
|
||||
EINA_LIST_FOREACH(pd->member_anim_obj_data_list, l, member_anim_obj_data)
|
||||
{
|
||||
if (member_anim_obj_data->anim_obj == anim_obj)
|
||||
break;
|
||||
}
|
||||
|
||||
return member_anim_obj_data;
|
||||
}
|
||||
|
||||
/* Delete member object data and remove the data from the member object data
|
||||
* list.
|
||||
* The member object data contains the repeated count of the member object.
|
||||
*/
|
||||
static void
|
||||
_member_anim_obj_data_del(Efl_Animation_Object_Group_Parallel_Data *pd,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
Member_Object_Data *member_anim_obj_data = _member_anim_obj_data_find(pd, anim_obj);
|
||||
if (member_anim_obj_data)
|
||||
{
|
||||
pd->member_anim_obj_data_list =
|
||||
eina_list_remove(pd->member_anim_obj_data_list, member_anim_obj_data);
|
||||
free(member_anim_obj_data);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_parallel_efl_animation_object_group_object_add(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Parallel_Data *pd,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
if (!anim_obj) return;
|
||||
|
||||
efl_animation_object_group_object_add(efl_super(eo_obj, MY_CLASS), anim_obj);
|
||||
|
||||
/* Add member object data and append the data to the member object data
|
||||
* list. */
|
||||
_member_anim_obj_data_add(pd, anim_obj, 0);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_parallel_efl_animation_object_group_object_del(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Parallel_Data *pd EINA_UNUSED,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
if (!anim_obj) return;
|
||||
|
||||
efl_animation_object_group_object_del(efl_super(eo_obj, MY_CLASS), anim_obj);
|
||||
|
||||
/* Delete member object data and remove the data from the member object
|
||||
* data list. */
|
||||
_member_anim_obj_data_del(pd, anim_obj);
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_object_group_parallel_efl_animation_object_total_duration_get(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Parallel_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Eina_List *anim_objs = efl_animation_object_group_objects_get(eo_obj);
|
||||
if (!anim_objs) return 0.0;
|
||||
|
||||
double total_duration = 0.0;
|
||||
Eina_List *l;
|
||||
Efl_Animation *anim_obj;
|
||||
EINA_LIST_FOREACH(anim_objs, l, anim_obj)
|
||||
{
|
||||
double child_total_duration =
|
||||
efl_animation_object_total_duration_get(anim_obj);
|
||||
|
||||
double start_delay = efl_animation_object_start_delay_get(anim_obj);
|
||||
if (start_delay > 0.0)
|
||||
child_total_duration += start_delay;
|
||||
|
||||
int child_repeat_count =
|
||||
efl_animation_object_repeat_count_get(anim_obj);
|
||||
if (child_repeat_count > 0)
|
||||
child_total_duration *= (child_repeat_count + 1);
|
||||
|
||||
if (child_total_duration > total_duration)
|
||||
total_duration = child_total_duration;
|
||||
}
|
||||
return total_duration;
|
||||
}
|
||||
|
||||
//Set how many times the given object has been repeated.
|
||||
static void
|
||||
_repeated_count_set(Efl_Animation_Object_Group_Parallel_Data *pd,
|
||||
Efl_Animation_Object *anim_obj,
|
||||
int repeated_count)
|
||||
{
|
||||
|
||||
Member_Object_Data *member_anim_obj_data =
|
||||
_member_anim_obj_data_find(pd, anim_obj);
|
||||
if (!member_anim_obj_data) return;
|
||||
|
||||
member_anim_obj_data->repeated_count = repeated_count;
|
||||
}
|
||||
|
||||
//Get how many times the given object has been repeated.
|
||||
static int
|
||||
_repeated_count_get(Efl_Animation_Object_Group_Parallel_Data *pd,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
Member_Object_Data *member_anim_obj_data =
|
||||
_member_anim_obj_data_find(pd, anim_obj);
|
||||
if (!member_anim_obj_data) return 0;
|
||||
|
||||
return member_anim_obj_data->repeated_count;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_parallel_efl_animation_object_progress_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Parallel_Data *pd,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0)) return;
|
||||
|
||||
Eina_List *anim_objs = efl_animation_object_group_objects_get(eo_obj);
|
||||
if (!anim_objs) return;
|
||||
|
||||
double group_total_duration =
|
||||
efl_animation_object_total_duration_get(eo_obj);
|
||||
|
||||
double elapsed_time = progress * group_total_duration;
|
||||
|
||||
Eina_List *l;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
EINA_LIST_FOREACH(anim_objs, l, anim_obj)
|
||||
{
|
||||
double total_duration =
|
||||
efl_animation_object_total_duration_get(anim_obj);
|
||||
double start_delay = efl_animation_object_start_delay_get(anim_obj);
|
||||
double anim_obj_progress;
|
||||
|
||||
Eina_Bool start_repeat = EINA_FALSE;
|
||||
|
||||
if (total_duration == 0.0)
|
||||
anim_obj_progress = 1.0;
|
||||
else
|
||||
{
|
||||
double elapsed_time_without_delay;
|
||||
|
||||
//If object is repeated, then recalculate progress.
|
||||
int repeated_count = _repeated_count_get(pd, anim_obj);
|
||||
if (repeated_count > 0)
|
||||
elapsed_time_without_delay =
|
||||
(elapsed_time - ((total_duration + start_delay) * repeated_count)) - start_delay;
|
||||
else
|
||||
elapsed_time_without_delay = elapsed_time - start_delay;
|
||||
|
||||
//Object should not start to wait for start delay time.
|
||||
if (elapsed_time_without_delay < 0.0) continue;
|
||||
|
||||
anim_obj_progress = elapsed_time_without_delay / total_duration;
|
||||
|
||||
if (anim_obj_progress > 1.0)
|
||||
anim_obj_progress = 1.0;
|
||||
|
||||
//Animation has been finished.
|
||||
if (anim_obj_progress == 1.0)
|
||||
{
|
||||
/* If object is finished and it should be repeated, then
|
||||
* increate the repeated count to recalculate progress. */
|
||||
int repeat_count =
|
||||
efl_animation_object_repeat_count_get(anim_obj);
|
||||
if (repeat_count > 0)
|
||||
{
|
||||
repeated_count = _repeated_count_get(pd, anim_obj);
|
||||
if (repeated_count < repeat_count)
|
||||
{
|
||||
repeated_count++;
|
||||
_repeated_count_set(pd, anim_obj, repeated_count);
|
||||
|
||||
start_repeat = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If object is repeated with reverse mode, then the progress value
|
||||
* should be modified as (1.0 - progress). */
|
||||
Efl_Animation_Object_Repeat_Mode repeat_mode
|
||||
= efl_animation_object_repeat_mode_get(anim_obj);
|
||||
if (repeat_mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE)
|
||||
{
|
||||
int repeated_count = _repeated_count_get(pd, anim_obj);
|
||||
if (repeated_count > 0)
|
||||
{
|
||||
if ((((repeated_count % 2) == 1) && (!start_repeat)) ||
|
||||
(((repeated_count % 2) == 0) && (start_repeat)))
|
||||
anim_obj_progress = 1.0 - anim_obj_progress;
|
||||
}
|
||||
}
|
||||
|
||||
//Apply interpolator
|
||||
Efl_Interpolator *group_interp =
|
||||
efl_animation_object_interpolator_get(eo_obj);
|
||||
|
||||
/* If group interpolator exists, then the group interpolator has been
|
||||
* already applied. So it is not needed to apply interpolator again. */
|
||||
if (!group_interp)
|
||||
{
|
||||
Efl_Interpolator *interpolator =
|
||||
efl_animation_object_interpolator_get(anim_obj);
|
||||
if (interpolator)
|
||||
{
|
||||
anim_obj_progress =
|
||||
efl_interpolator_interpolate(interpolator,
|
||||
anim_obj_progress);
|
||||
}
|
||||
}
|
||||
|
||||
efl_animation_object_progress_set(anim_obj, anim_obj_progress);
|
||||
}
|
||||
|
||||
efl_animation_object_progress_set(efl_super(eo_obj, MY_CLASS), progress);
|
||||
}
|
||||
|
||||
/* Internal EO APIs */
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_GROUP_PARALLEL_EXTRA_OPS \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_group_object_add, _efl_animation_object_group_parallel_efl_animation_object_group_object_add), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_group_object_del, _efl_animation_object_group_parallel_efl_animation_object_group_object_del), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_total_duration_get, _efl_animation_object_group_parallel_efl_animation_object_total_duration_get)
|
||||
|
||||
#include "efl_animation_object_group_parallel.eo.c"
|
|
@ -1,12 +0,0 @@
|
|||
import efl_animation_types;
|
||||
|
||||
class Efl.Animation.Object.Group.Parallel (Efl.Animation.Object.Group)
|
||||
{
|
||||
[[Efl group parallel animation object class]]
|
||||
data: Efl_Animation_Object_Group_Parallel_Data;
|
||||
methods {
|
||||
}
|
||||
implements {
|
||||
Efl.Animation.Object.progress_set;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
#define EFL_ANIMATION_OBJECT_PROTECTED
|
||||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_OBJECT_GROUP_PARALLEL_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_GROUP_PARALLEL_DATA_GET(o, pd) \
|
||||
Efl_Animation_Object_Group_Parallel_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_OBJECT_GROUP_PARALLEL_CLASS)
|
||||
|
||||
typedef struct _Member_Object_Data
|
||||
{
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
int repeated_count; /* How many times object has been
|
||||
* repeated. */
|
||||
} Member_Object_Data;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Group_Parallel_Data
|
||||
{
|
||||
Eina_List *member_anim_obj_data_list; //List of Member_Object_Data
|
||||
} Efl_Animation_Object_Group_Parallel_Data;
|
|
@ -1,15 +0,0 @@
|
|||
#define EFL_ANIMATION_OBJECT_PROTECTED
|
||||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_OBJECT_GROUP_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_GROUP_DATA_GET(o, pd) \
|
||||
Efl_Animation_Object_Group_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_OBJECT_GROUP_CLASS)
|
||||
|
||||
typedef struct _Efl_Animation_Object_Group_Data
|
||||
{
|
||||
Eina_List *anim_objs;
|
||||
} Efl_Animation_Object_Group_Data;
|
|
@ -1,269 +0,0 @@
|
|||
#include "efl_animation_object_group_sequential_private.h"
|
||||
|
||||
/* Add member object data and append the data to the member object data list.
|
||||
* The member object data contains the repeated count of the member object.
|
||||
*/
|
||||
static void
|
||||
_member_anim_obj_data_add(Efl_Animation_Object_Group_Sequential_Data *pd,
|
||||
Efl_Animation_Object *anim_obj,
|
||||
int repeated_count)
|
||||
{
|
||||
Member_Object_Data *member_anim_obj_data =
|
||||
calloc(1, sizeof(Member_Object_Data));
|
||||
|
||||
if (!member_anim_obj_data) return;
|
||||
|
||||
member_anim_obj_data->anim_obj = anim_obj;
|
||||
member_anim_obj_data->repeated_count = repeated_count;
|
||||
|
||||
pd->member_anim_obj_data_list =
|
||||
eina_list_append(pd->member_anim_obj_data_list, member_anim_obj_data);
|
||||
}
|
||||
|
||||
/* Find the member object data which contains the repeated count of the member
|
||||
* object. */
|
||||
static Member_Object_Data *
|
||||
_member_anim_obj_data_find(Efl_Animation_Object_Group_Sequential_Data *pd,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
Eina_List *l;
|
||||
Member_Object_Data *member_anim_obj_data = NULL;
|
||||
EINA_LIST_FOREACH(pd->member_anim_obj_data_list, l, member_anim_obj_data)
|
||||
{
|
||||
if (member_anim_obj_data->anim_obj == anim_obj)
|
||||
break;
|
||||
}
|
||||
|
||||
return member_anim_obj_data;
|
||||
}
|
||||
|
||||
/* Delete member object data and remove the data from the member object data
|
||||
* list.
|
||||
* The member object data contains the repeated count of the member object.
|
||||
*/
|
||||
static void
|
||||
_member_anim_obj_data_del(Efl_Animation_Object_Group_Sequential_Data *pd,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
Member_Object_Data *member_anim_obj_data =
|
||||
_member_anim_obj_data_find(pd, anim_obj);
|
||||
if (member_anim_obj_data)
|
||||
{
|
||||
pd->member_anim_obj_data_list =
|
||||
eina_list_remove(pd->member_anim_obj_data_list,
|
||||
member_anim_obj_data);
|
||||
free(member_anim_obj_data);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_sequential_efl_animation_object_group_object_add(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Sequential_Data *pd EINA_UNUSED,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
if (!anim_obj) return;
|
||||
|
||||
efl_animation_object_group_object_add(efl_super(eo_obj, MY_CLASS), anim_obj);
|
||||
|
||||
/* Add member object data and append the data to the member object data
|
||||
* list. */
|
||||
_member_anim_obj_data_add(pd, anim_obj, 0);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_sequential_efl_animation_object_group_object_del(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Sequential_Data *pd EINA_UNUSED,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
if (!anim_obj) return;
|
||||
|
||||
efl_animation_object_group_object_del(efl_super(eo_obj, MY_CLASS), anim_obj);
|
||||
|
||||
/* Delete member object data and remove the data from the member object
|
||||
* data list. */
|
||||
_member_anim_obj_data_del(pd, anim_obj);
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_object_group_sequential_efl_animation_object_total_duration_get(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Sequential_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Eina_List *anim_objs = efl_animation_object_group_objects_get(eo_obj);
|
||||
if (!anim_objs) return 0.0;
|
||||
|
||||
double total_duration = 0.0;
|
||||
Eina_List *l;
|
||||
Efl_Animation *anim_obj;
|
||||
EINA_LIST_FOREACH(anim_objs, l, anim_obj)
|
||||
{
|
||||
double child_total_duration =
|
||||
efl_animation_object_total_duration_get(anim_obj);
|
||||
|
||||
double start_delay = efl_animation_object_start_delay_get(anim_obj);
|
||||
if (start_delay > 0.0)
|
||||
child_total_duration += start_delay;
|
||||
|
||||
int child_repeat_count =
|
||||
efl_animation_object_repeat_count_get(anim_obj);
|
||||
if (child_repeat_count > 0)
|
||||
child_total_duration *= (child_repeat_count + 1);
|
||||
|
||||
total_duration += child_total_duration;
|
||||
}
|
||||
return total_duration;
|
||||
}
|
||||
|
||||
//Set how many times the given object has been repeated.
|
||||
static void
|
||||
_repeated_count_set(Efl_Animation_Object_Group_Sequential_Data *pd,
|
||||
Efl_Animation_Object *anim_obj,
|
||||
int repeated_count)
|
||||
{
|
||||
|
||||
Member_Object_Data *member_anim_obj_data = _member_anim_obj_data_find(pd, anim_obj);
|
||||
if (!member_anim_obj_data) return;
|
||||
|
||||
member_anim_obj_data->repeated_count = repeated_count;
|
||||
}
|
||||
|
||||
//Get how many times the given object has been repeated.
|
||||
static int
|
||||
_repeated_count_get(Efl_Animation_Object_Group_Sequential_Data *pd,
|
||||
Efl_Animation_Object *anim_obj)
|
||||
{
|
||||
Member_Object_Data *member_anim_obj_data =
|
||||
_member_anim_obj_data_find(pd, anim_obj);
|
||||
if (!member_anim_obj_data) return 0;
|
||||
|
||||
return member_anim_obj_data->repeated_count;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_group_sequential_efl_animation_object_progress_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Group_Sequential_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0)) return;
|
||||
|
||||
Eina_List *anim_objs = efl_animation_object_group_objects_get(eo_obj);
|
||||
if (!anim_objs) return;
|
||||
|
||||
double group_total_duration =
|
||||
efl_animation_object_total_duration_get(eo_obj);
|
||||
|
||||
double elapsed_time = progress * group_total_duration;
|
||||
|
||||
double sum_prev_total_duration = 0.0;
|
||||
|
||||
Eina_List *l;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
EINA_LIST_FOREACH(anim_objs, l, anim_obj)
|
||||
{
|
||||
//Current animation object does not start
|
||||
if (sum_prev_total_duration > elapsed_time) break;
|
||||
|
||||
//Sum the current total duration
|
||||
double total_duration =
|
||||
efl_animation_object_total_duration_get(anim_obj);
|
||||
double start_delay = efl_animation_object_start_delay_get(anim_obj);
|
||||
double anim_obj_progress;
|
||||
|
||||
Eina_Bool start_repeat = EINA_FALSE;
|
||||
|
||||
if (total_duration == 0.0)
|
||||
anim_obj_progress = 1.0;
|
||||
else
|
||||
{
|
||||
//If object is repeated, then recalculate progress.
|
||||
int repeated_count = _repeated_count_get(pd, anim_obj);
|
||||
if (repeated_count > 0)
|
||||
sum_prev_total_duration +=
|
||||
((total_duration + start_delay) * repeated_count);
|
||||
|
||||
double elapsed_time_without_delay =
|
||||
elapsed_time - sum_prev_total_duration - start_delay;
|
||||
|
||||
//Object should not start to wait for start delay time.
|
||||
if (elapsed_time_without_delay < 0.0) break;
|
||||
|
||||
anim_obj_progress = elapsed_time_without_delay / total_duration;
|
||||
|
||||
if (anim_obj_progress > 1.0)
|
||||
anim_obj_progress = 1.0;
|
||||
|
||||
//Animation has been finished.
|
||||
if (anim_obj_progress == 1.0)
|
||||
{
|
||||
/* If object is finished and it should be repeated, then
|
||||
* increate the repeated count to recalculate progress. */
|
||||
int repeat_count =
|
||||
efl_animation_object_repeat_count_get(anim_obj);
|
||||
if (repeat_count > 0)
|
||||
{
|
||||
repeated_count = _repeated_count_get(pd, anim_obj);
|
||||
if (repeated_count < repeat_count)
|
||||
{
|
||||
repeated_count++;
|
||||
_repeated_count_set(pd, anim_obj, repeated_count);
|
||||
|
||||
start_repeat = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the sum of the previous objects' total durations and start
|
||||
* delays */
|
||||
sum_prev_total_duration += (total_duration + start_delay);
|
||||
|
||||
if ((anim_obj_progress == 1.0) && (!start_repeat) &&
|
||||
(!efl_animation_object_final_state_keep_get(anim_obj)))
|
||||
continue;
|
||||
|
||||
/* If object is repeated with reverse mode, then the progress value
|
||||
* should be modified as (1.0 - progress). */
|
||||
Efl_Animation_Object_Repeat_Mode repeat_mode
|
||||
= efl_animation_object_repeat_mode_get(anim_obj);
|
||||
if (repeat_mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE)
|
||||
{
|
||||
int repeated_count = _repeated_count_get(pd, anim_obj);
|
||||
if (repeated_count > 0)
|
||||
{
|
||||
if ((((repeated_count % 2) == 1) && (!start_repeat)) ||
|
||||
(((repeated_count % 2) == 0) && (start_repeat)))
|
||||
anim_obj_progress = 1.0 - anim_obj_progress;
|
||||
}
|
||||
}
|
||||
|
||||
//Apply interpolator
|
||||
Efl_Interpolator *group_interp =
|
||||
efl_animation_object_interpolator_get(eo_obj);
|
||||
|
||||
/* If group interpolator exists, then the group interpolator has been
|
||||
* already applied. So it is not needed to apply interpolator again. */
|
||||
if (!group_interp)
|
||||
{
|
||||
Efl_Interpolator *interpolator =
|
||||
efl_animation_object_interpolator_get(anim_obj);
|
||||
if (interpolator)
|
||||
{
|
||||
anim_obj_progress =
|
||||
efl_interpolator_interpolate(interpolator,
|
||||
anim_obj_progress);
|
||||
}
|
||||
}
|
||||
|
||||
efl_animation_object_progress_set(anim_obj, anim_obj_progress);
|
||||
}
|
||||
|
||||
efl_animation_object_progress_set(efl_super(eo_obj, MY_CLASS), progress);
|
||||
}
|
||||
|
||||
/* Internal EO APIs */
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_GROUP_SEQUENTIAL_EXTRA_OPS \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_group_object_add, _efl_animation_object_group_sequential_efl_animation_object_group_object_add), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_group_object_del, _efl_animation_object_group_sequential_efl_animation_object_group_object_del), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_total_duration_get, _efl_animation_object_group_sequential_efl_animation_object_total_duration_get)
|
||||
|
||||
#include "efl_animation_object_group_sequential.eo.c"
|
|
@ -1,12 +0,0 @@
|
|||
import efl_animation_types;
|
||||
|
||||
class Efl.Animation.Object.Group.Sequential (Efl.Animation.Object.Group)
|
||||
{
|
||||
[[Efl group sequential animation object class]]
|
||||
data: Efl_Animation_Object_Group_Sequential_Data;
|
||||
methods {
|
||||
}
|
||||
implements {
|
||||
Efl.Animation.Object.progress_set;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
#define EFL_ANIMATION_OBJECT_PROTECTED
|
||||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_OBJECT_GROUP_SEQUENTIAL_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_GROUP_SEQUENTIAL_DATA_GET(o, pd) \
|
||||
Efl_Animation_Object_Group_Sequential_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_OBJECT_GROUP_SEQUENTIAL_CLASS)
|
||||
|
||||
typedef struct _Member_Object_Data
|
||||
{
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
int repeated_count; /* How many times object has been
|
||||
* repeated. */
|
||||
} Member_Object_Data;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Group_Sequential_Data
|
||||
{
|
||||
Eina_List *member_anim_obj_data_list; //List of Member_Object_Data
|
||||
} Efl_Animation_Object_Group_Sequential_Data;
|
|
@ -1,56 +0,0 @@
|
|||
#define EFL_ANIMATION_OBJECT_PROTECTED
|
||||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_OBJECT_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
typedef struct _Target_State
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
int r, g, b, a;
|
||||
|
||||
Evas_Map *map;
|
||||
Eina_Bool enable_map : 1;
|
||||
} Target_State;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Data
|
||||
{
|
||||
Ecore_Animator *animator;
|
||||
|
||||
Ecore_Timer *start_delay_timer;
|
||||
double start_delay_time;
|
||||
|
||||
struct {
|
||||
double begin;
|
||||
double current;
|
||||
double pause_begin;
|
||||
} time;
|
||||
|
||||
Efl_Canvas_Object *target;
|
||||
Target_State *target_state;
|
||||
|
||||
double progress;
|
||||
|
||||
double duration;
|
||||
double paused_time;
|
||||
|
||||
Efl_Animation_Object_Repeat_Mode repeat_mode;
|
||||
int repeat_count;
|
||||
int remaining_repeat_count;
|
||||
|
||||
Efl_Interpolator *interpolator;
|
||||
|
||||
Eina_Bool auto_del : 1;
|
||||
Eina_Bool is_started : 1;
|
||||
Eina_Bool is_cancelled : 1;
|
||||
Eina_Bool is_ended : 1;
|
||||
Eina_Bool is_paused : 1;
|
||||
Eina_Bool keep_final_state : 1;
|
||||
Eina_Bool is_direction_forward : 1;
|
||||
Eina_Bool is_direction_changed : 1;
|
||||
} Efl_Animation_Object_Data;
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_DATA_GET(o, pd) \
|
||||
Efl_Animation_Object_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_OBJECT_CLASS)
|
|
@ -1,243 +0,0 @@
|
|||
#include "efl_animation_object_rotate_private.h"
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_rotate_rotate_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Rotate_Data *pd,
|
||||
double from_degree,
|
||||
double to_degree,
|
||||
Efl_Canvas_Object *pivot,
|
||||
double cx,
|
||||
double cy)
|
||||
{
|
||||
pd->from.degree = from_degree;
|
||||
pd->to.degree = to_degree;
|
||||
|
||||
pd->rel_pivot.obj = pivot;
|
||||
pd->rel_pivot.cx = cx;
|
||||
pd->rel_pivot.cy = cy;
|
||||
|
||||
//Update absolute pivot based on relative pivot
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
if (pivot)
|
||||
evas_object_geometry_get(pivot, &x, &y, &w, &h);
|
||||
else
|
||||
{
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
}
|
||||
|
||||
pd->abs_pivot.cx = x + (w * cx);
|
||||
pd->abs_pivot.cy = y + (h * cy);
|
||||
|
||||
pd->use_rel_pivot = EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_rotate_rotate_get(Eo *eo_obj,
|
||||
Efl_Animation_Object_Rotate_Data *pd,
|
||||
double *from_degree,
|
||||
double *to_degree,
|
||||
Efl_Canvas_Object **pivot,
|
||||
double *cx,
|
||||
double *cy)
|
||||
{
|
||||
//Update relative pivot based on absolute pivot
|
||||
if (!pd->use_rel_pivot)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
|
||||
if (w != 0)
|
||||
pd->rel_pivot.cx = (double)(pd->abs_pivot.cx - x) / w;
|
||||
else
|
||||
pd->rel_pivot.cx = 0.0;
|
||||
|
||||
if (h != 0)
|
||||
pd->rel_pivot.cy = (double)(pd->abs_pivot.cy - y) / h;
|
||||
else
|
||||
pd->rel_pivot.cy = 0.0;
|
||||
}
|
||||
|
||||
if (from_degree)
|
||||
*from_degree = pd->from.degree;
|
||||
|
||||
if (to_degree)
|
||||
*to_degree = pd->to.degree;
|
||||
|
||||
if (pivot)
|
||||
*pivot = pd->rel_pivot.obj;
|
||||
|
||||
if (cx)
|
||||
*cx = pd->rel_pivot.cx;
|
||||
|
||||
if (cy)
|
||||
*cy = pd->rel_pivot.cy;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_rotate_rotate_absolute_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Rotate_Data *pd,
|
||||
double from_degree,
|
||||
double to_degree,
|
||||
Evas_Coord cx,
|
||||
Evas_Coord cy)
|
||||
{
|
||||
pd->from.degree = from_degree;
|
||||
pd->to.degree = to_degree;
|
||||
|
||||
pd->abs_pivot.cx = cx;
|
||||
pd->abs_pivot.cy = cy;
|
||||
|
||||
//Update relative pivot based on absolute pivot
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
|
||||
pd->rel_pivot.obj = NULL;
|
||||
|
||||
if (w != 0)
|
||||
pd->rel_pivot.cx = (double)(cx - x) / w;
|
||||
else
|
||||
pd->rel_pivot.cx = 0.0;
|
||||
|
||||
if (h != 0)
|
||||
pd->rel_pivot.cy = (double)(cy - y) / h;
|
||||
else
|
||||
pd->rel_pivot.cy = 0.0;
|
||||
|
||||
pd->use_rel_pivot = EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_rotate_rotate_absolute_get(Eo *eo_obj,
|
||||
Efl_Animation_Object_Rotate_Data *pd,
|
||||
double *from_degree,
|
||||
double *to_degree,
|
||||
Evas_Coord *cx,
|
||||
Evas_Coord *cy)
|
||||
{
|
||||
//Update absolute pivot based on relative pivot
|
||||
if (pd->use_rel_pivot)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
if (pd->rel_pivot.obj)
|
||||
evas_object_geometry_get(pd->rel_pivot.obj, &x, &y, &w, &h);
|
||||
else
|
||||
{
|
||||
Efl_Canvas_Object *target
|
||||
= efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
}
|
||||
|
||||
pd->abs_pivot.cx = x + (w * pd->rel_pivot.cx);
|
||||
pd->abs_pivot.cy = y + (h * pd->rel_pivot.cy);
|
||||
}
|
||||
|
||||
if (from_degree)
|
||||
*from_degree = pd->from.degree;
|
||||
|
||||
if (to_degree)
|
||||
*to_degree = pd->to.degree;
|
||||
|
||||
if (cx)
|
||||
*cx = pd->abs_pivot.cx;
|
||||
|
||||
if (cy)
|
||||
*cy = pd->abs_pivot.cy;
|
||||
}
|
||||
|
||||
static void
|
||||
_progress_set(Eo *eo_obj, double progress)
|
||||
{
|
||||
EFL_ANIMATION_OBJECT_ROTATE_DATA_GET(eo_obj, pd);
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (!target) return;
|
||||
|
||||
double degree =
|
||||
(pd->from.degree * (1.0 - progress)) + (pd->to.degree * progress);
|
||||
|
||||
if (pd->use_rel_pivot)
|
||||
{
|
||||
efl_gfx_map_rotate(target,
|
||||
degree,
|
||||
pd->rel_pivot.obj,
|
||||
pd->rel_pivot.cx, pd->rel_pivot.cy);
|
||||
}
|
||||
else
|
||||
{
|
||||
efl_gfx_map_rotate_absolute(target,
|
||||
degree,
|
||||
pd->abs_pivot.cx, pd->abs_pivot.cy);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_rotate_efl_animation_object_progress_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Rotate_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0)) return;
|
||||
|
||||
_progress_set(eo_obj, progress);
|
||||
|
||||
efl_animation_object_progress_set(efl_super(eo_obj, MY_CLASS), progress);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_animation_object_rotate_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Animation_Object_Rotate_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->from.degree = 0.0;
|
||||
pd->to.degree = 0.0;
|
||||
|
||||
pd->rel_pivot.obj = NULL;
|
||||
pd->rel_pivot.cx = 0.5;
|
||||
pd->rel_pivot.cy = 0.5;
|
||||
|
||||
pd->abs_pivot.cx = 0;
|
||||
pd->abs_pivot.cy = 0;
|
||||
|
||||
pd->use_rel_pivot = EINA_TRUE;
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
/* Internal EO APIs */
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_rotate_set, EFL_FUNC_CALL(from_degree, to_degree, pivot, cx, cy), double from_degree, double to_degree, Efl_Canvas_Object *pivot, double cx, double cy);
|
||||
EOAPI EFL_VOID_FUNC_BODYV_CONST(efl_animation_object_rotate_get, EFL_FUNC_CALL(from_degree, to_degree, pivot, cx, cy), double *from_degree, double *to_degree, Efl_Canvas_Object **pivot, double *cx, double *cy);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_rotate_absolute_set, EFL_FUNC_CALL(from_degree, to_degree, cx, cy), double from_degree, double to_degree, int cx, int cy);
|
||||
EOAPI EFL_VOID_FUNC_BODYV_CONST(efl_animation_object_rotate_absolute_get, EFL_FUNC_CALL(from_degree, to_degree, cx, cy), double *from_degree, double *to_degree, int *cx, int *cy);
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_ROTATE_EXTRA_OPS \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_rotate_set, _efl_animation_object_rotate_rotate_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_rotate_get, _efl_animation_object_rotate_rotate_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_rotate_absolute_set, _efl_animation_object_rotate_rotate_absolute_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_rotate_absolute_get, _efl_animation_object_rotate_rotate_absolute_get)
|
||||
|
||||
#include "efl_animation_object_rotate.eo.c"
|
|
@ -1,11 +0,0 @@
|
|||
import efl_animation_types;
|
||||
|
||||
class Efl.Animation.Object.Rotate (Efl.Animation.Object)
|
||||
{
|
||||
[[Efl rotate animation object class]]
|
||||
data: Efl_Animation_Object_Rotate_Data;
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Animation.Object.progress_set;
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
#define EFL_ANIMATION_OBJECT_PROTECTED
|
||||
#define EFL_ANIMATION_OBJECT_ROTATE_PROTECTED
|
||||
|
||||
#include "evas_common_private.h"
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_OBJECT_ROTATE_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_ROTATE_DATA_GET(o, pd) \
|
||||
Efl_Animation_Object_Rotate_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_OBJECT_ROTATE_CLASS)
|
||||
|
||||
typedef struct _Efl_Animation_Object_Rotate_Property
|
||||
{
|
||||
double degree;
|
||||
} Efl_Animation_Object_Rotate_Property;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Rotate_Absolute_Pivot
|
||||
{
|
||||
Evas_Coord cx, cy;
|
||||
} Efl_Animation_Object_Rotate_Absolute_Pivot;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Rotate_Relative_Pivot
|
||||
{
|
||||
Efl_Canvas_Object *obj;
|
||||
double cx, cy;
|
||||
} Efl_Animation_Object_Rotate_Relative_Pivot;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Rotate_Data
|
||||
{
|
||||
Efl_Animation_Object_Rotate_Property from;
|
||||
Efl_Animation_Object_Rotate_Property to;
|
||||
|
||||
Efl_Animation_Object_Rotate_Absolute_Pivot abs_pivot;
|
||||
Efl_Animation_Object_Rotate_Relative_Pivot rel_pivot;
|
||||
|
||||
Eina_Bool use_rel_pivot;
|
||||
} Efl_Animation_Object_Rotate_Data;
|
|
@ -1,272 +0,0 @@
|
|||
#include "efl_animation_object_scale_private.h"
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_scale_scale_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Scale_Data *pd,
|
||||
double from_scale_x,
|
||||
double from_scale_y,
|
||||
double to_scale_x,
|
||||
double to_scale_y,
|
||||
Efl_Canvas_Object *pivot,
|
||||
double cx,
|
||||
double cy)
|
||||
{
|
||||
pd->from.scale_x = from_scale_x;
|
||||
pd->from.scale_y = from_scale_y;
|
||||
|
||||
pd->to.scale_x = to_scale_x;
|
||||
pd->to.scale_y = to_scale_y;
|
||||
|
||||
pd->rel_pivot.obj = pivot;
|
||||
pd->rel_pivot.cx = cx;
|
||||
pd->rel_pivot.cy = cy;
|
||||
|
||||
//Update absolute pivot based on relative pivot
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
if (pivot)
|
||||
evas_object_geometry_get(pivot, &x, &y, &w, &h);
|
||||
else
|
||||
{
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
}
|
||||
|
||||
pd->abs_pivot.cx = x + (w * cx);
|
||||
pd->abs_pivot.cy = y + (h * cy);
|
||||
|
||||
pd->use_rel_pivot = EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_scale_scale_get(Eo *eo_obj,
|
||||
Efl_Animation_Object_Scale_Data *pd,
|
||||
double *from_scale_x,
|
||||
double *from_scale_y,
|
||||
double *to_scale_x,
|
||||
double *to_scale_y,
|
||||
Efl_Canvas_Object **pivot,
|
||||
double *cx,
|
||||
double *cy)
|
||||
{
|
||||
//Update relative pivot based on absolute pivot
|
||||
if (!pd->use_rel_pivot)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
|
||||
if (w != 0)
|
||||
pd->rel_pivot.cx = (double)(pd->abs_pivot.cx - x) / w;
|
||||
else
|
||||
pd->rel_pivot.cx = 0.0;
|
||||
|
||||
if (h != 0)
|
||||
pd->rel_pivot.cy = (double)(pd->abs_pivot.cy - y) / h;
|
||||
else
|
||||
pd->rel_pivot.cy = 0.0;
|
||||
}
|
||||
|
||||
if (from_scale_x)
|
||||
*from_scale_x = pd->from.scale_x;
|
||||
|
||||
if (from_scale_y)
|
||||
*from_scale_y = pd->from.scale_y;
|
||||
|
||||
if (to_scale_x)
|
||||
*to_scale_x = pd->to.scale_x;
|
||||
|
||||
if (to_scale_y)
|
||||
*to_scale_y = pd->to.scale_y;
|
||||
|
||||
if (pivot)
|
||||
*pivot = pd->rel_pivot.obj;
|
||||
|
||||
if (cx)
|
||||
*cx = pd->rel_pivot.cx;
|
||||
|
||||
if (cy)
|
||||
*cy = pd->rel_pivot.cy;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_scale_scale_absolute_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Scale_Data *pd,
|
||||
double from_scale_x,
|
||||
double from_scale_y,
|
||||
double to_scale_x,
|
||||
double to_scale_y,
|
||||
Evas_Coord cx,
|
||||
Evas_Coord cy)
|
||||
{
|
||||
pd->from.scale_x = from_scale_x;
|
||||
pd->from.scale_y = from_scale_y;
|
||||
|
||||
pd->to.scale_x = to_scale_x;
|
||||
pd->to.scale_y = to_scale_y;
|
||||
|
||||
pd->abs_pivot.cx = cx;
|
||||
pd->abs_pivot.cy = cy;
|
||||
|
||||
//Update relative pivot based on absolute pivot
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
|
||||
pd->rel_pivot.obj = NULL;
|
||||
|
||||
if (w != 0)
|
||||
pd->rel_pivot.cx = (double)(cx - x) / w;
|
||||
else
|
||||
pd->rel_pivot.cx = 0.0;
|
||||
|
||||
if (h != 0)
|
||||
pd->rel_pivot.cy = (double)(cy - y) / h;
|
||||
else
|
||||
pd->rel_pivot.cy = 0.0;
|
||||
|
||||
pd->use_rel_pivot = EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_scale_scale_absolute_get(Eo *eo_obj,
|
||||
Efl_Animation_Object_Scale_Data *pd,
|
||||
double *from_scale_x,
|
||||
double *from_scale_y,
|
||||
double *to_scale_x,
|
||||
double *to_scale_y,
|
||||
Evas_Coord *cx,
|
||||
Evas_Coord *cy)
|
||||
{
|
||||
//Update absolute pivot based on relative pivot
|
||||
if (pd->use_rel_pivot)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
if (pd->rel_pivot.obj)
|
||||
evas_object_geometry_get(pd->rel_pivot.obj, &x, &y, &w, &h);
|
||||
else
|
||||
{
|
||||
Efl_Canvas_Object *target
|
||||
= efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
}
|
||||
|
||||
pd->abs_pivot.cx = x + (w * pd->rel_pivot.cx);
|
||||
pd->abs_pivot.cy = y + (h * pd->rel_pivot.cy);
|
||||
}
|
||||
|
||||
if (from_scale_x)
|
||||
*from_scale_x = pd->from.scale_x;
|
||||
|
||||
if (from_scale_y)
|
||||
*from_scale_y = pd->from.scale_y;
|
||||
|
||||
if (to_scale_x)
|
||||
*to_scale_x = pd->to.scale_x;
|
||||
|
||||
if (to_scale_y)
|
||||
*to_scale_y = pd->to.scale_y;
|
||||
|
||||
if (cx)
|
||||
*cx = pd->abs_pivot.cx;
|
||||
|
||||
if (cy)
|
||||
*cy = pd->abs_pivot.cy;
|
||||
}
|
||||
|
||||
static void
|
||||
_progress_set(Eo *eo_obj, double progress)
|
||||
{
|
||||
EFL_ANIMATION_OBJECT_SCALE_DATA_GET(eo_obj, pd);
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (!target) return;
|
||||
|
||||
double scale_x =
|
||||
(pd->from.scale_x * (1.0 - progress)) + (pd->to.scale_x * progress);
|
||||
|
||||
double scale_y =
|
||||
(pd->from.scale_y * (1.0 - progress)) + (pd->to.scale_y * progress);
|
||||
|
||||
if (pd->use_rel_pivot)
|
||||
{
|
||||
efl_gfx_map_zoom(target,
|
||||
scale_x, scale_y,
|
||||
pd->rel_pivot.obj,
|
||||
pd->rel_pivot.cx, pd->rel_pivot.cy);
|
||||
}
|
||||
else
|
||||
{
|
||||
efl_gfx_map_zoom_absolute(target,
|
||||
scale_x, scale_y,
|
||||
pd->abs_pivot.cx, pd->abs_pivot.cy);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_scale_efl_animation_object_progress_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Scale_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0)) return;
|
||||
|
||||
_progress_set(eo_obj, progress);
|
||||
|
||||
efl_animation_object_progress_set(efl_super(eo_obj, MY_CLASS), progress);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_animation_object_scale_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Animation_Object_Scale_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->from.scale_x = 1.0;
|
||||
pd->from.scale_y = 1.0;
|
||||
|
||||
pd->rel_pivot.obj = NULL;
|
||||
pd->rel_pivot.cx = 0.5;
|
||||
pd->rel_pivot.cy = 0.5;
|
||||
|
||||
pd->abs_pivot.cx = 0;
|
||||
pd->abs_pivot.cy = 0;
|
||||
|
||||
pd->use_rel_pivot = EINA_TRUE;
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
/* Internal EO APIs */
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_scale_set, EFL_FUNC_CALL(from_scale_x, from_scale_y, to_scale_x, to_scale_y, pivot, cx, cy), double from_scale_x, double from_scale_y, double to_scale_x, double to_scale_y, Efl_Canvas_Object *pivot, double cx, double cy);
|
||||
EOAPI EFL_VOID_FUNC_BODYV_CONST(efl_animation_object_scale_get, EFL_FUNC_CALL(from_scale_x, from_scale_y, to_scale_x, to_scale_y, pivot, cx, cy), double *from_scale_x, double *from_scale_y, double *to_scale_x, double *to_scale_y, Efl_Canvas_Object **pivot, double *cx, double *cy);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_scale_absolute_set, EFL_FUNC_CALL(from_scale_x, from_scale_y, to_scale_x, to_scale_y, cx, cy), double from_scale_x, double from_scale_y, double to_scale_x, double to_scale_y, int cx, int cy);
|
||||
EOAPI EFL_VOID_FUNC_BODYV_CONST(efl_animation_object_scale_absolute_get, EFL_FUNC_CALL(from_scale_x, from_scale_y, to_scale_x, to_scale_y, cx, cy), double *from_scale_x, double *from_scale_y, double *to_scale_x, double *to_scale_y, int *cx, int *cy);
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_SCALE_EXTRA_OPS \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_scale_set, _efl_animation_object_scale_scale_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_scale_get, _efl_animation_object_scale_scale_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_scale_absolute_set, _efl_animation_object_scale_scale_absolute_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_scale_absolute_get, _efl_animation_object_scale_scale_absolute_get)
|
||||
|
||||
#include "efl_animation_object_scale.eo.c"
|
|
@ -1,11 +0,0 @@
|
|||
import efl_animation_types;
|
||||
|
||||
class Efl.Animation.Object.Scale (Efl.Animation.Object)
|
||||
{
|
||||
[[Efl scale animation object class]]
|
||||
data: Efl_Animation_Object_Scale_Data;
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Animation.Object.progress_set;
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
#define EFL_ANIMATION_OBJECT_PROTECTED
|
||||
#define EFL_ANIMATION_OBJECT_SCALE_PROTECTED
|
||||
|
||||
#include "evas_common_private.h"
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_OBJECT_SCALE_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_SCALE_DATA_GET(o, pd) \
|
||||
Efl_Animation_Object_Scale_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_OBJECT_SCALE_CLASS)
|
||||
|
||||
typedef struct _Efl_Animation_Object_Scale_Property
|
||||
{
|
||||
double scale_x, scale_y;
|
||||
} Efl_Animation_Object_Scale_Property;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Scale_Absolute_Pivot
|
||||
{
|
||||
Evas_Coord cx, cy;
|
||||
} Efl_Animation_Object_Scale_Absolute_Pivot;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Scale_Relative_Pivot
|
||||
{
|
||||
Efl_Canvas_Object *obj;
|
||||
double cx, cy;
|
||||
} Efl_Animation_Object_Scale_Relative_Pivot;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Scale_Data
|
||||
{
|
||||
Efl_Animation_Object_Scale_Property from;
|
||||
Efl_Animation_Object_Scale_Property to;
|
||||
|
||||
Efl_Animation_Object_Scale_Absolute_Pivot abs_pivot;
|
||||
Efl_Animation_Object_Scale_Relative_Pivot rel_pivot;
|
||||
|
||||
Eina_Bool use_rel_pivot;
|
||||
} Efl_Animation_Object_Scale_Data;
|
|
@ -1,240 +0,0 @@
|
|||
#include "efl_animation_object_translate_private.h"
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_translate_translate_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Translate_Data *pd,
|
||||
Evas_Coord from_x,
|
||||
Evas_Coord from_y,
|
||||
Evas_Coord to_x,
|
||||
Evas_Coord to_y)
|
||||
{
|
||||
pd->from.move_x = from_x;
|
||||
pd->from.move_y = from_y;
|
||||
|
||||
pd->to.move_x = to_x;
|
||||
pd->to.move_y = to_y;
|
||||
|
||||
//Update absolute coordinate based on relative move
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, NULL, NULL);
|
||||
|
||||
pd->from.x = pd->from.move_x + x;
|
||||
pd->from.y = pd->from.move_y + y;
|
||||
|
||||
pd->to.x = pd->to.move_x + x;
|
||||
pd->to.y = pd->to.move_y + y;
|
||||
|
||||
pd->use_rel_move = EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_translate_translate_get(Eo *eo_obj,
|
||||
Efl_Animation_Object_Translate_Data *pd,
|
||||
Evas_Coord *from_x,
|
||||
Evas_Coord *from_y,
|
||||
Evas_Coord *to_x,
|
||||
Evas_Coord *to_y)
|
||||
{
|
||||
//Update relative move based on absolute coordinate
|
||||
if (!pd->use_rel_move)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, NULL, NULL);
|
||||
|
||||
pd->from.move_x = pd->from.x - x;
|
||||
pd->from.move_y = pd->from.y - y;
|
||||
|
||||
pd->to.move_x = pd->to.x - x;
|
||||
pd->to.move_y = pd->to.y - y;
|
||||
}
|
||||
|
||||
if (from_x)
|
||||
*from_x = pd->from.move_x;
|
||||
if (from_y)
|
||||
*from_y = pd->from.move_y;
|
||||
|
||||
if (to_x)
|
||||
*to_x = pd->to.move_x;
|
||||
if (to_y)
|
||||
*to_y = pd->to.move_y;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_translate_translate_absolute_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Translate_Data *pd,
|
||||
Evas_Coord from_x,
|
||||
Evas_Coord from_y,
|
||||
Evas_Coord to_x,
|
||||
Evas_Coord to_y)
|
||||
{
|
||||
pd->from.x = from_x;
|
||||
pd->from.y = from_y;
|
||||
|
||||
pd->to.x = to_x;
|
||||
pd->to.y = to_y;
|
||||
|
||||
//Update relative move based on absolute coordinate
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, NULL, NULL);
|
||||
|
||||
pd->from.move_x = pd->from.x - x;
|
||||
pd->from.move_y = pd->from.y - y;
|
||||
|
||||
pd->to.move_x = pd->to.x - x;
|
||||
pd->to.move_y = pd->to.y - y;
|
||||
|
||||
pd->use_rel_move = EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_translate_translate_absolute_get(Eo *eo_obj,
|
||||
Efl_Animation_Object_Translate_Data *pd,
|
||||
Evas_Coord *from_x,
|
||||
Evas_Coord *from_y,
|
||||
Evas_Coord *to_x,
|
||||
Evas_Coord *to_y)
|
||||
{
|
||||
//Update absolute coordinate based on relative move
|
||||
if (pd->use_rel_move)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, NULL, NULL);
|
||||
|
||||
pd->from.x = pd->from.move_x + x;
|
||||
pd->from.y = pd->from.move_y + y;
|
||||
|
||||
pd->to.x = pd->to.move_x + x;
|
||||
pd->to.y = pd->to.move_y + y;
|
||||
}
|
||||
|
||||
if (from_x)
|
||||
*from_x = pd->from.x;
|
||||
if (from_y)
|
||||
*from_y = pd->from.y;
|
||||
|
||||
if (to_x)
|
||||
*to_x = pd->to.x;
|
||||
if (to_y)
|
||||
*to_y = pd->to.y;
|
||||
}
|
||||
|
||||
static void
|
||||
_pre_started_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
EFL_ANIMATION_OBJECT_TRANSLATE_DATA_GET(event->object, pd);
|
||||
|
||||
pd->start_x = 0;
|
||||
pd->start_y = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(event->object);
|
||||
if (!target) return;
|
||||
|
||||
Evas_Coord x, y;
|
||||
evas_object_geometry_get(target, &x, &y, NULL, NULL);
|
||||
|
||||
pd->start_x = x;
|
||||
pd->start_y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
_progress_set(Eo *eo_obj, double progress)
|
||||
{
|
||||
EFL_ANIMATION_OBJECT_TRANSLATE_DATA_GET(eo_obj, pd);
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_object_target_get(eo_obj);
|
||||
if (!target) return;
|
||||
|
||||
Evas_Coord new_x = 0;
|
||||
Evas_Coord new_y = 0;
|
||||
|
||||
if (pd->use_rel_move)
|
||||
{
|
||||
new_x =
|
||||
(pd->from.move_x * (1.0 - progress)) + (pd->to.move_x * progress);
|
||||
new_y =
|
||||
(pd->from.move_y * (1.0 - progress)) + (pd->to.move_y * progress);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Since efl_gfx_map_translate() moves position relatively, the original
|
||||
* position should be subtracted to move position absolutely. */
|
||||
new_x =
|
||||
(pd->from.x * (1.0 - progress)) + (pd->to.x * progress) - pd->start_x;
|
||||
new_y =
|
||||
(pd->from.y * (1.0 - progress)) + (pd->to.y * progress) - pd->start_y;
|
||||
}
|
||||
|
||||
efl_gfx_map_translate(target, (double) new_x, (double) new_y, 0.0);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_object_translate_efl_animation_object_progress_set(Eo *eo_obj,
|
||||
Efl_Animation_Object_Translate_Data *pd EINA_UNUSED,
|
||||
double progress)
|
||||
{
|
||||
if ((progress < 0.0) || (progress > 1.0)) return;
|
||||
|
||||
_progress_set(eo_obj, progress);
|
||||
|
||||
efl_animation_object_progress_set(efl_super(eo_obj, MY_CLASS), progress);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_animation_object_translate_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Animation_Object_Translate_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->from.move_x = 0;
|
||||
pd->from.move_y = 0;
|
||||
pd->from.x = 0;
|
||||
pd->from.y = 0;
|
||||
|
||||
pd->to.move_x = 0;
|
||||
pd->to.move_y = 0;
|
||||
pd->to.x = 0;
|
||||
pd->to.y = 0;
|
||||
|
||||
pd->start_x = 0;
|
||||
pd->start_y = 0;
|
||||
|
||||
pd->use_rel_move = EINA_TRUE;
|
||||
|
||||
//pre_started event is supported within class only (protected event)
|
||||
efl_event_callback_add(eo_obj, EFL_ANIMATION_OBJECT_EVENT_PRE_STARTED,
|
||||
_pre_started_cb, NULL);
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
/* Internal EO APIs */
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_translate_set, EFL_FUNC_CALL(from_x, from_y, to_x, to_y), int from_x, int from_y, int to_x, int to_y);
|
||||
EOAPI EFL_VOID_FUNC_BODYV_CONST(efl_animation_object_translate_get, EFL_FUNC_CALL(from_x, from_y, to_x, to_y), int *from_x, int *from_y, int *to_x, int *to_y);
|
||||
|
||||
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_translate_absolute_set, EFL_FUNC_CALL(from_x, from_y, to_x, to_y), int from_x, int from_y, int to_x, int to_y);
|
||||
EOAPI EFL_VOID_FUNC_BODYV_CONST(efl_animation_object_translate_absolute_get, EFL_FUNC_CALL(from_x, from_y, to_x, to_y), int *from_x, int *from_y, int *to_x, int *to_y);
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_TRANSLATE_EXTRA_OPS \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_translate_set, _efl_animation_object_translate_translate_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_translate_get, _efl_animation_object_translate_translate_get), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_translate_absolute_set, _efl_animation_object_translate_translate_absolute_set), \
|
||||
EFL_OBJECT_OP_FUNC(efl_animation_object_translate_absolute_get, _efl_animation_object_translate_translate_absolute_get)
|
||||
|
||||
#include "efl_animation_object_translate.eo.c"
|
|
@ -1,11 +0,0 @@
|
|||
import efl_animation_types;
|
||||
|
||||
class Efl.Animation.Object.Translate (Efl.Animation.Object)
|
||||
{
|
||||
[[Efl translate animation object class]]
|
||||
data: Efl_Animation_Object_Translate_Data;
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Animation.Object.progress_set;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
#define EFL_ANIMATION_OBJECT_PROTECTED
|
||||
|
||||
#include "evas_common_private.h"
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_OBJECT_TRANSLATE_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_OBJECT_TRANSLATE_DATA_GET(o, pd) \
|
||||
Efl_Animation_Object_Translate_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_OBJECT_TRANSLATE_CLASS)
|
||||
|
||||
typedef struct _Efl_Animation_Object_Translate_Property
|
||||
{
|
||||
Evas_Coord move_x, move_y;
|
||||
Evas_Coord x, y;
|
||||
} Efl_Animation_Object_Translate_Property;
|
||||
|
||||
typedef struct _Efl_Animation_Object_Translate_Data
|
||||
{
|
||||
Efl_Animation_Object_Translate_Property from;
|
||||
Efl_Animation_Object_Translate_Property to;
|
||||
|
||||
Evas_Coord start_x, start_y;
|
||||
|
||||
Eina_Bool use_rel_move;
|
||||
} Efl_Animation_Object_Translate_Data;
|
|
@ -0,0 +1,384 @@
|
|||
#include "efl_animation_player_private.h"
|
||||
|
||||
static void
|
||||
_target_del_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
Efl_Animation_Player_Data *pd = data;
|
||||
pd->target = NULL;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_player_target_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Player_Data *pd,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
efl_event_callback_add(target, EFL_EVENT_DEL, _target_del_cb, pd);
|
||||
|
||||
pd->target = target;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Canvas_Object *
|
||||
_efl_animation_player_target_get(Eo *eo_obj EINA_UNUSED, Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
return pd->target;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_player_auto_del_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Player_Data *pd,
|
||||
Eina_Bool auto_del)
|
||||
{
|
||||
pd->auto_del = auto_del;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_animation_player_auto_del_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
return pd->auto_del;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_player_animation_set(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd,
|
||||
Efl_Animation *anim)
|
||||
{
|
||||
if (anim == pd->animation)
|
||||
return;
|
||||
|
||||
if (!efl_isa(anim, EFL_ANIMATION_CLASS))
|
||||
{
|
||||
ERR("Passed argument [%p]:[%s] is not an Efl.Animation",
|
||||
anim, efl_class_name_get(efl_class_get(anim)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pd->animation)
|
||||
{
|
||||
efl_player_stop(eo_obj);
|
||||
efl_unref(pd->animation);
|
||||
}
|
||||
pd->animation = anim;
|
||||
efl_ref(pd->animation);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Animation *
|
||||
_efl_animation_player_animation_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
return pd->animation;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_animator_cb(void *data)
|
||||
{
|
||||
Eo *eo_obj = data;
|
||||
EFL_ANIMATION_PLAYER_DATA_GET(eo_obj, pd);
|
||||
EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
|
||||
double duration, elapsed_time, vector;
|
||||
|
||||
if (efl_player_seekable_get(eo_obj))
|
||||
{
|
||||
pd->time.current = ecore_loop_time_get();
|
||||
|
||||
duration = efl_animation_duration_get(anim);
|
||||
elapsed_time = pd->time.current - pd->time.prev;
|
||||
vector = elapsed_time / duration;
|
||||
|
||||
if (vector <= DBL_EPSILON)
|
||||
return ECORE_CALLBACK_RENEW; // There is no update.
|
||||
|
||||
//TODO: check negative play_speed.
|
||||
if (!pd->is_direction_forward)
|
||||
vector *= -1;
|
||||
pd->progress += vector;
|
||||
|
||||
if (pd->progress > 1.0)
|
||||
pd->progress = 1,0;
|
||||
else if (pd->progress < 0.0)
|
||||
pd->progress = 0,0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->progress = (double)(pd->is_direction_forward);
|
||||
}
|
||||
|
||||
efl_animation_apply(anim, pd->progress, efl_animation_player_target_get(eo_obj));
|
||||
|
||||
Efl_Animation_Player_Running_Event_Info event_info;
|
||||
event_info.progress = pd->progress;
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING,
|
||||
&event_info);
|
||||
pd->time.prev = pd->time.current;
|
||||
|
||||
//Not end. Keep going.
|
||||
if (fabs((!!(pd->is_direction_forward)) - pd->progress) > DBL_EPSILON)
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
||||
//Repeat animation
|
||||
if ((efl_animation_repeat_count_get(anim) == EFL_ANIMATION_REPEAT_INFINITE) ||
|
||||
(pd->remaining_repeat_count > 0))
|
||||
{
|
||||
if (pd->remaining_repeat_count > 0)
|
||||
pd->remaining_repeat_count--;
|
||||
|
||||
if (efl_animation_repeat_mode_get(anim) == EFL_ANIMATION_REPEAT_MODE_REVERSE)
|
||||
{
|
||||
pd->is_direction_forward = !pd->is_direction_forward;
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->progress = 0.0;
|
||||
}
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
efl_player_stop(eo_obj);
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
static void
|
||||
_start(Eo *eo_obj, Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
|
||||
|
||||
pd->is_direction_forward = EINA_TRUE;
|
||||
|
||||
pd->remaining_repeat_count = efl_animation_repeat_count_get(anim);
|
||||
|
||||
ecore_animator_del(pd->animator);
|
||||
pd->animator = NULL;
|
||||
pd->time.prev = ecore_loop_time_get();
|
||||
|
||||
//pre started event is supported within class only (protected event)
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED,
|
||||
NULL);
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, NULL);
|
||||
|
||||
pd->animator = ecore_animator_add(_animator_cb, eo_obj);
|
||||
|
||||
_animator_cb(eo_obj);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_start_delay_timer_cb(void *data)
|
||||
{
|
||||
Eo *eo_obj = data;
|
||||
EFL_ANIMATION_PLAYER_DATA_GET(eo_obj, pd);
|
||||
|
||||
pd->start_delay_timer = NULL;
|
||||
|
||||
_start(eo_obj, pd);
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_player_efl_player_start(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
double start_delay;
|
||||
EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
|
||||
|
||||
if (!efl_player_playable_get(eo_obj)) return;
|
||||
pd->is_play = EINA_TRUE;
|
||||
//TODO: check this case is correct
|
||||
if (pd->start_delay_timer) return;
|
||||
|
||||
pd->progress = 0.0;
|
||||
start_delay = efl_animation_start_delay_get(anim);
|
||||
if (start_delay > 0.0)
|
||||
{
|
||||
pd->start_delay_timer = ecore_timer_add(start_delay,
|
||||
_start_delay_timer_cb, eo_obj);
|
||||
return;
|
||||
}
|
||||
|
||||
_start(eo_obj, pd);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_player_efl_player_stop(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
|
||||
Eina_Bool play = efl_player_play_get(eo_obj);
|
||||
if (play)
|
||||
{
|
||||
efl_player_play_set(eo_obj, EINA_FALSE);
|
||||
//Reset the state of the target to the initial state
|
||||
if ((efl_animation_final_state_keep_get(anim)) &&
|
||||
(efl_animation_repeat_mode_get(anim) != EFL_ANIMATION_REPEAT_MODE_REVERSE) &&
|
||||
(!(efl_animation_repeat_count_get(anim) & 1)))
|
||||
{
|
||||
pd->progress = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->progress = 0.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->progress = 0.0;
|
||||
}
|
||||
efl_animation_apply(anim, pd->progress, efl_animation_player_target_get(eo_obj));
|
||||
if (play)
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
|
||||
|
||||
if (pd->auto_del) efl_del(eo_obj);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_player_efl_player_play_set(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd,
|
||||
Eina_Bool play)
|
||||
{
|
||||
if (efl_player_play_get(eo_obj) == !!play)
|
||||
return;
|
||||
|
||||
pd->is_play = play;
|
||||
if (play)
|
||||
{
|
||||
//TODO: check this case is correct.
|
||||
if (pd->start_delay_timer) return;
|
||||
|
||||
pd->time.prev = ecore_loop_time_get();
|
||||
pd->animator = ecore_animator_add(_animator_cb, eo_obj);
|
||||
|
||||
_animator_cb(eo_obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecore_timer_del(pd->start_delay_timer);
|
||||
pd->start_delay_timer = NULL;
|
||||
ecore_animator_del(pd->animator);
|
||||
pd->animator = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_animation_player_efl_player_play_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
return pd->is_play;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_animation_player_efl_player_playable_get(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Efl_Animation *anim = efl_animation_player_animation_get(eo_obj);
|
||||
|
||||
return efl_playable_get(anim);
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_player_efl_player_position_get(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd EINA_UNUSED)
|
||||
{
|
||||
//TODO: this is not correct
|
||||
Efl_Animation *anim = efl_animation_player_animation_get(eo_obj);
|
||||
double length = efl_player_length_get(anim);
|
||||
|
||||
return length * efl_player_progress_get(anim);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_player_efl_player_position_set(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd EINA_UNUSED,
|
||||
double sec)
|
||||
{
|
||||
//TODO: this is not correct
|
||||
if (!efl_player_seekable_get(eo_obj))
|
||||
return;
|
||||
|
||||
EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
|
||||
double length = efl_player_length_get(anim);
|
||||
pd->progress = sec / length;
|
||||
efl_animation_apply(anim, pd->progress, efl_animation_player_target_get(eo_obj));
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_player_efl_player_progress_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
return pd->progress;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_player_efl_player_play_speed_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Player_Data *pd,
|
||||
double play_speed)
|
||||
{
|
||||
//TODO: check reverse play case.
|
||||
if (play_speed < 0)
|
||||
return;
|
||||
pd->play_speed = play_speed;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_player_efl_player_play_speed_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
return pd->play_speed;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
_efl_animation_player_efl_player_length_get(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd EINA_UNUSED)
|
||||
{
|
||||
EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
|
||||
return efl_playable_length_get(anim);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_animation_player_efl_player_seekable_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Player_Data *pd EINA_UNUSED)
|
||||
{
|
||||
EFL_ANIMATION_PLAYER_ANIMATION_GET(eo_obj, anim);
|
||||
return efl_playable_seekable_get(anim);
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
_efl_animation_player_efl_object_constructor(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->time.begin = 0.0;
|
||||
pd->time.current = 0.0;
|
||||
|
||||
pd->animation = NULL;
|
||||
|
||||
pd->progress = 0.0;
|
||||
|
||||
//pd->auto_del = EINA_TRUE;
|
||||
|
||||
return eo_obj;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_player_efl_object_destructor(Eo *eo_obj,
|
||||
Efl_Animation_Player_Data *pd)
|
||||
{
|
||||
if (pd->animator)
|
||||
{
|
||||
ecore_animator_del(pd->animator);
|
||||
pd->animator = NULL;
|
||||
|
||||
//Reset the state of the target to the initial state
|
||||
efl_player_stop(eo_obj);
|
||||
|
||||
efl_event_callback_call(eo_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, NULL);
|
||||
}
|
||||
efl_unref(pd->animation);
|
||||
|
||||
efl_destructor(efl_super(eo_obj, MY_CLASS));
|
||||
}
|
||||
|
||||
EWAPI const Efl_Event_Description _EFL_ANIMATION_PLAYER_EVENT_PRE_STARTED =
|
||||
EFL_EVENT_DESCRIPTION("pre_started");
|
||||
|
||||
#include "efl_animation_player.eo.c"
|
|
@ -0,0 +1,55 @@
|
|||
import efl_animation_types;
|
||||
|
||||
class Efl.Animation.Player (Efl.Object, Efl.Player)
|
||||
{
|
||||
[[Efl animation object class]]
|
||||
methods {
|
||||
@property animation {
|
||||
set {}
|
||||
get {}
|
||||
values {
|
||||
animation: Efl.Animation;
|
||||
}
|
||||
}
|
||||
@property auto_del {
|
||||
[[Auto delete property]]
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
auto_del: bool; [[$true to delete animation object automatically when animation is finished or animation is cancelled, $false otherwise.]]
|
||||
}
|
||||
}
|
||||
@property target {
|
||||
[[Target object property]]
|
||||
set {
|
||||
}
|
||||
get {
|
||||
}
|
||||
values {
|
||||
target: Efl.Canvas.Object; [[Target object which is applied animation.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
Efl.Player.start;
|
||||
Efl.Player.stop;
|
||||
Efl.Player.play { get; set; }
|
||||
Efl.Player.playable { get; }
|
||||
Efl.Player.position { get; set; }
|
||||
Efl.Player.progress { get;}
|
||||
Efl.Player.play_speed { get; set; }
|
||||
//Efl.Player.volume { get; set; }
|
||||
//Efl.Player.mute { get; set; }
|
||||
Efl.Player.length { get; }
|
||||
Efl.Player.seekable { get; }
|
||||
}
|
||||
events {
|
||||
started; [[Animation is started.]]
|
||||
running; [[Animation is running.]]
|
||||
ended; [[Animation is ended.]]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
#define EFL_ANIMATION_PLAYER_PROTECTED
|
||||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_PLAYER_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
#if 0
|
||||
typedef struct _Target_State
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
int r, g, b, a;
|
||||
|
||||
Evas_Map *map;
|
||||
Eina_Bool enable_map : 1;
|
||||
} Target_State;
|
||||
#endif
|
||||
|
||||
typedef struct _Efl_Animation_Player_Data
|
||||
{
|
||||
Ecore_Animator *animator;
|
||||
Ecore_Timer *start_delay_timer;
|
||||
|
||||
struct {
|
||||
double prev;
|
||||
double begin;
|
||||
double current;
|
||||
double pause_begin;
|
||||
} time;
|
||||
|
||||
Efl_Animation *animation;
|
||||
Efl_Canvas_Object *target;
|
||||
|
||||
double progress;
|
||||
double play_speed;
|
||||
|
||||
int remaining_repeat_count;
|
||||
|
||||
Efl_Interpolator *interpolator;
|
||||
|
||||
Eina_Bool auto_del : 1;
|
||||
Eina_Bool is_play : 1;
|
||||
Eina_Bool keep_final_state : 1;
|
||||
Eina_Bool is_direction_forward : 1;
|
||||
} Efl_Animation_Player_Data;
|
||||
|
||||
#define EFL_ANIMATION_PLAYER_DATA_GET(o, pd) \
|
||||
Efl_Animation_Player_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_PLAYER_CLASS)
|
||||
|
||||
#define EFL_ANIMATION_PLAYER_ANIMATION_GET(o, anim) \
|
||||
Efl_Animation *anim = efl_animation_player_animation_get(o)
|
|
@ -3,13 +3,8 @@
|
|||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
|
||||
typedef struct _Efl_Animation_Data
|
||||
{
|
||||
Efl_Canvas_Object *target;
|
||||
|
||||
double duration;
|
||||
|
||||
double start_delay_time;
|
||||
|
@ -24,3 +19,10 @@ typedef struct _Efl_Animation_Data
|
|||
|
||||
#define EFL_ANIMATION_DATA_GET(o, pd) \
|
||||
Efl_Animation_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_CLASS)
|
||||
|
||||
#define GET_STATUS(from, to, progress) \
|
||||
((from) + (((to) - (from)) * (progress)))
|
||||
|
||||
#define FINAL_STATE_IS_REVERSE(anim) \
|
||||
((efl_animation_repeat_mode_get(anim) == EFL_ANIMATION_REPEAT_MODE_REVERSE) && \
|
||||
(efl_animation_repeat_count_get(anim) & 1))
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
#include "efl_animation_rotate_private.h"
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_ROTATE_CLASS
|
||||
|
||||
static double
|
||||
_rotation_get(Eo *target)
|
||||
{
|
||||
double x1, x2, y1, y2;
|
||||
double theta;
|
||||
|
||||
efl_gfx_map_coord_absolute_get(target, 0, &x1, &y1, NULL);
|
||||
efl_gfx_map_coord_absolute_get(target, 1, &x2, &y2, NULL);
|
||||
theta = atan((y2 - y1) / (x2 - x1));
|
||||
|
||||
return theta * 180 / M_PI;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_rotate_rotate_set(Eo *eo_obj,
|
||||
_efl_animation_rotate_rotate_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Rotate_Data *pd,
|
||||
double from_degree,
|
||||
double to_degree,
|
||||
|
@ -12,33 +27,15 @@ _efl_animation_rotate_rotate_set(Eo *eo_obj,
|
|||
pd->from.degree = from_degree;
|
||||
pd->to.degree = to_degree;
|
||||
|
||||
//TODO: check whether ref for pivot should be added.
|
||||
pd->rel_pivot.obj = pivot;
|
||||
pd->rel_pivot.cx = cx;
|
||||
pd->rel_pivot.cy = cy;
|
||||
|
||||
//Update absolute pivot based on relative pivot
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
if (pivot)
|
||||
evas_object_geometry_get(pivot, &x, &y, &w, &h);
|
||||
else
|
||||
{
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
}
|
||||
|
||||
pd->abs_pivot.cx = x + (w * cx);
|
||||
pd->abs_pivot.cy = y + (h * cy);
|
||||
|
||||
pd->use_rel_pivot = EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_rotate_rotate_get(Eo *eo_obj,
|
||||
_efl_animation_rotate_rotate_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Rotate_Data *pd,
|
||||
double *from_degree,
|
||||
double *to_degree,
|
||||
|
@ -46,27 +43,10 @@ _efl_animation_rotate_rotate_get(Eo *eo_obj,
|
|||
double *cx,
|
||||
double *cy)
|
||||
{
|
||||
//Update relative pivot based on absolute pivot
|
||||
if (!pd->use_rel_pivot)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
|
||||
if (w != 0)
|
||||
pd->rel_pivot.cx = (double)(pd->abs_pivot.cx - x) / w;
|
||||
else
|
||||
pd->rel_pivot.cx = 0.0;
|
||||
|
||||
if (h != 0)
|
||||
pd->rel_pivot.cy = (double)(pd->abs_pivot.cy - y) / h;
|
||||
else
|
||||
pd->rel_pivot.cy = 0.0;
|
||||
ERR("Animation is done in absolute value.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (from_degree)
|
||||
|
@ -86,7 +66,7 @@ _efl_animation_rotate_rotate_get(Eo *eo_obj,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_rotate_rotate_absolute_set(Eo *eo_obj,
|
||||
_efl_animation_rotate_rotate_absolute_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Rotate_Data *pd,
|
||||
double from_degree,
|
||||
double to_degree,
|
||||
|
@ -98,59 +78,21 @@ _efl_animation_rotate_rotate_absolute_set(Eo *eo_obj,
|
|||
|
||||
pd->abs_pivot.cx = cx;
|
||||
pd->abs_pivot.cy = cy;
|
||||
|
||||
//Update relative pivot based on absolute pivot
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
|
||||
pd->rel_pivot.obj = NULL;
|
||||
|
||||
if (w != 0)
|
||||
pd->rel_pivot.cx = (double)(cx - x) / w;
|
||||
else
|
||||
pd->rel_pivot.cx = 0.0;
|
||||
|
||||
if (h != 0)
|
||||
pd->rel_pivot.cy = (double)(cy - y) / h;
|
||||
else
|
||||
pd->rel_pivot.cy = 0.0;
|
||||
|
||||
pd->use_rel_pivot = EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_rotate_rotate_absolute_get(Eo *eo_obj,
|
||||
_efl_animation_rotate_rotate_absolute_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Rotate_Data *pd,
|
||||
double *from_degree,
|
||||
double *to_degree,
|
||||
Evas_Coord *cx,
|
||||
Evas_Coord *cy)
|
||||
{
|
||||
//Update relative pivot based on absolute pivot
|
||||
if (pd->use_rel_pivot)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
if (pd->rel_pivot.obj)
|
||||
evas_object_geometry_get(pd->rel_pivot.obj, &x, &y, &w, &h);
|
||||
else
|
||||
{
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
}
|
||||
|
||||
pd->abs_pivot.cx = x + (w * pd->rel_pivot.cx);
|
||||
pd->abs_pivot.cy = y + (h * pd->rel_pivot.cy);
|
||||
ERR("Animation is done in relative value.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (from_degree)
|
||||
|
@ -166,54 +108,36 @@ _efl_animation_rotate_rotate_absolute_get(Eo *eo_obj,
|
|||
*cy = pd->abs_pivot.cy;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Animation_Object *
|
||||
_efl_animation_rotate_efl_animation_object_create(Eo *eo_obj,
|
||||
Efl_Animation_Rotate_Data *pd)
|
||||
EOLIAN static double
|
||||
_efl_animation_rotate_efl_animation_animation_apply(Eo *eo_obj,
|
||||
Efl_Animation_Rotate_Data *pd,
|
||||
double progress,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
Efl_Animation_Object_Rotate *anim_obj
|
||||
= efl_add(EFL_ANIMATION_OBJECT_ROTATE_CLASS, NULL);
|
||||
double new_degree;
|
||||
double prev_degree;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
efl_animation_object_target_set(anim_obj, target);
|
||||
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
|
||||
if (!target) return progress;
|
||||
|
||||
Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
|
||||
efl_animation_object_final_state_keep_set(anim_obj, state_keep);
|
||||
|
||||
double duration = efl_animation_duration_get(eo_obj);
|
||||
efl_animation_object_duration_set(anim_obj, duration);
|
||||
|
||||
double start_delay_time = efl_animation_start_delay_get(eo_obj);
|
||||
efl_animation_object_start_delay_set(anim_obj, start_delay_time);
|
||||
|
||||
Efl_Animation_Object_Repeat_Mode repeat_mode =
|
||||
(Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
|
||||
efl_animation_object_repeat_mode_set(anim_obj, repeat_mode);
|
||||
|
||||
int repeat_count = efl_animation_repeat_count_get(eo_obj);
|
||||
efl_animation_object_repeat_count_set(anim_obj, repeat_count);
|
||||
|
||||
Efl_Interpolator *interpolator = efl_animation_interpolator_get(eo_obj);
|
||||
efl_animation_object_interpolator_set(anim_obj, interpolator);
|
||||
prev_degree = _rotation_get(target);
|
||||
new_degree = GET_STATUS(pd->from.degree, pd->to.degree, progress);
|
||||
|
||||
if (pd->use_rel_pivot)
|
||||
{
|
||||
efl_animation_object_rotate_set(anim_obj,
|
||||
pd->from.degree,
|
||||
pd->to.degree,
|
||||
pd->rel_pivot.obj,
|
||||
pd->rel_pivot.cx,
|
||||
pd->rel_pivot.cy);
|
||||
efl_gfx_map_rotate(target,
|
||||
new_degree - prev_degree,
|
||||
(pd->rel_pivot.obj) ? pd->rel_pivot.obj : target,
|
||||
pd->rel_pivot.cx, pd->rel_pivot.cy);
|
||||
}
|
||||
else
|
||||
{
|
||||
efl_animation_object_rotate_absolute_set(anim_obj,
|
||||
pd->from.degree,
|
||||
pd->to.degree,
|
||||
pd->abs_pivot.cx,
|
||||
pd->abs_pivot.cy);
|
||||
efl_gfx_map_rotate_absolute(target,
|
||||
new_degree - prev_degree,
|
||||
pd->abs_pivot.cx, pd->abs_pivot.cy);
|
||||
}
|
||||
|
||||
return anim_obj;
|
||||
return progress;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
|
|
|
@ -35,6 +35,6 @@ class Efl.Animation.Rotate (Efl.Animation)
|
|||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Animation.object_create;
|
||||
Efl.Animation.animation_apply;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_ROTATE_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
#include "efl_animation_private.h"
|
||||
|
||||
#define EFL_ANIMATION_ROTATE_DATA_GET(o, pd) \
|
||||
Efl_Animation_Rotate_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_ROTATE_CLASS)
|
||||
|
|
|
@ -1,7 +1,30 @@
|
|||
#include "efl_animation_scale_private.h"
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_SCALE_CLASS
|
||||
|
||||
static Efl_Animation_Scale_Property
|
||||
_scale_get(Eo *target)
|
||||
{
|
||||
double x1, x2, x3, y1, y2, y3, w, h;
|
||||
Efl_Animation_Scale_Property scale;
|
||||
Eina_Rect geometry;
|
||||
|
||||
geometry = efl_gfx_geometry_get(target);
|
||||
efl_gfx_map_coord_absolute_get(target, 0, &x1, &y1, NULL);
|
||||
efl_gfx_map_coord_absolute_get(target, 1, &x2, &y2, NULL);
|
||||
efl_gfx_map_coord_absolute_get(target, 2, &x3, &y3, NULL);
|
||||
|
||||
w = sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
|
||||
h = sqrt(((x3 - x2) * (x3 - x2)) + ((y3 - y2) * (y3 - y2)));
|
||||
|
||||
scale.scale_x = w / geometry.w;
|
||||
scale.scale_y = h / geometry.h;
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_scale_scale_set(Eo *eo_obj,
|
||||
_efl_animation_scale_scale_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Scale_Data *pd,
|
||||
double from_scale_x,
|
||||
double from_scale_y,
|
||||
|
@ -21,29 +44,11 @@ _efl_animation_scale_scale_set(Eo *eo_obj,
|
|||
pd->rel_pivot.cx = cx;
|
||||
pd->rel_pivot.cy = cy;
|
||||
|
||||
//Update absolute pivot based on relative pivot
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
if (pivot)
|
||||
evas_object_geometry_get(pivot, &x, &y, &w, &h);
|
||||
else
|
||||
{
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
}
|
||||
|
||||
pd->abs_pivot.cx = x + (w * cx);
|
||||
pd->abs_pivot.cy = y + (h * cy);
|
||||
|
||||
pd->use_rel_pivot = EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_scale_scale_get(Eo *eo_obj,
|
||||
_efl_animation_scale_scale_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Scale_Data *pd,
|
||||
double *from_scale_x,
|
||||
double *from_scale_y,
|
||||
|
@ -53,27 +58,10 @@ _efl_animation_scale_scale_get(Eo *eo_obj,
|
|||
double *cx,
|
||||
double *cy)
|
||||
{
|
||||
//Update relative pivot based on absolute pivot
|
||||
if (!pd->use_rel_pivot)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
|
||||
if (w != 0)
|
||||
pd->rel_pivot.cx = (double)(pd->abs_pivot.cx - x) / w;
|
||||
else
|
||||
pd->rel_pivot.cx = 0.0;
|
||||
|
||||
if (h != 0)
|
||||
pd->rel_pivot.cy = (double)(pd->abs_pivot.cy - y) / h;
|
||||
else
|
||||
pd->rel_pivot.cy = 0.0;
|
||||
ERR("Animation is done in absolute value.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (from_scale_x)
|
||||
|
@ -99,7 +87,7 @@ _efl_animation_scale_scale_get(Eo *eo_obj,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_scale_scale_absolute_set(Eo *eo_obj,
|
||||
_efl_animation_scale_scale_absolute_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Scale_Data *pd,
|
||||
double from_scale_x,
|
||||
double from_scale_y,
|
||||
|
@ -117,33 +105,11 @@ _efl_animation_scale_scale_absolute_set(Eo *eo_obj,
|
|||
pd->abs_pivot.cx = cx;
|
||||
pd->abs_pivot.cy = cy;
|
||||
|
||||
//Update relative pivot based on absolute pivot
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
|
||||
pd->rel_pivot.obj = NULL;
|
||||
|
||||
if (w != 0)
|
||||
pd->rel_pivot.cx = (double)(cx - x) / w;
|
||||
else
|
||||
pd->rel_pivot.cx = 0.0;
|
||||
|
||||
if (h != 0)
|
||||
pd->rel_pivot.cy = (double)(cy - y) / h;
|
||||
else
|
||||
pd->rel_pivot.cy = 0.0;
|
||||
|
||||
pd->use_rel_pivot = EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_scale_scale_absolute_get(Eo *eo_obj,
|
||||
_efl_animation_scale_scale_absolute_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Scale_Data *pd,
|
||||
double *from_scale_x,
|
||||
double *from_scale_y,
|
||||
|
@ -152,25 +118,10 @@ _efl_animation_scale_scale_absolute_get(Eo *eo_obj,
|
|||
Evas_Coord *cx,
|
||||
Evas_Coord *cy)
|
||||
{
|
||||
//Update absolute pivot based on relative pivot
|
||||
if (pd->use_rel_pivot)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
Evas_Coord w = 0;
|
||||
Evas_Coord h = 0;
|
||||
|
||||
if (pd->rel_pivot.obj)
|
||||
evas_object_geometry_get(pd->rel_pivot.obj, &x, &y, &w, &h);
|
||||
else
|
||||
{
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, &w, &h);
|
||||
}
|
||||
|
||||
pd->abs_pivot.cx = x + (w * pd->rel_pivot.cx);
|
||||
pd->abs_pivot.cy = y + (h * pd->rel_pivot.cy);
|
||||
ERR("Animation is done in relative value.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (from_scale_x)
|
||||
|
@ -192,52 +143,39 @@ _efl_animation_scale_scale_absolute_get(Eo *eo_obj,
|
|||
*cy = pd->abs_pivot.cy;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Animation_Object *
|
||||
_efl_animation_scale_efl_animation_object_create(Eo *eo_obj,
|
||||
Efl_Animation_Scale_Data *pd)
|
||||
EOLIAN static double
|
||||
_efl_animation_scale_efl_animation_animation_apply(Eo *eo_obj,
|
||||
Efl_Animation_Scale_Data *pd,
|
||||
double progress,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
Efl_Animation_Object_Scale *anim_obj
|
||||
= efl_add(EFL_ANIMATION_OBJECT_SCALE_CLASS, NULL);
|
||||
Efl_Animation_Scale_Property prev_scale;
|
||||
Efl_Animation_Scale_Property new_scale;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
efl_animation_object_target_set(anim_obj, target);
|
||||
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
|
||||
if (!target) return progress;
|
||||
|
||||
Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
|
||||
efl_animation_object_final_state_keep_set(anim_obj, state_keep);
|
||||
|
||||
double duration = efl_animation_duration_get(eo_obj);
|
||||
efl_animation_object_duration_set(anim_obj, duration);
|
||||
|
||||
double start_delay_time = efl_animation_start_delay_get(eo_obj);
|
||||
efl_animation_object_start_delay_set(anim_obj, start_delay_time);
|
||||
|
||||
Efl_Animation_Object_Repeat_Mode repeat_mode =
|
||||
(Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
|
||||
efl_animation_object_repeat_mode_set(anim_obj, repeat_mode);
|
||||
|
||||
int repeat_count = efl_animation_repeat_count_get(eo_obj);
|
||||
efl_animation_object_repeat_count_set(anim_obj, repeat_count);
|
||||
|
||||
Efl_Interpolator *interpolator = efl_animation_interpolator_get(eo_obj);
|
||||
efl_animation_object_interpolator_set(anim_obj, interpolator);
|
||||
prev_scale = _scale_get(target);
|
||||
new_scale.scale_x = GET_STATUS(pd->from.scale_x, pd->to.scale_x, progress);
|
||||
new_scale.scale_y = GET_STATUS(pd->from.scale_y, pd->to.scale_y, progress);
|
||||
|
||||
if (pd->use_rel_pivot)
|
||||
{
|
||||
efl_animation_object_scale_set(anim_obj,
|
||||
pd->from.scale_x, pd->from.scale_y,
|
||||
pd->to.scale_x, pd->to.scale_y,
|
||||
pd->rel_pivot.obj,
|
||||
efl_gfx_map_zoom(target,
|
||||
new_scale.scale_x / prev_scale.scale_x,
|
||||
new_scale.scale_y / prev_scale.scale_y,
|
||||
(pd->rel_pivot.obj) ? pd->rel_pivot.obj : target,
|
||||
pd->rel_pivot.cx, pd->rel_pivot.cy);
|
||||
}
|
||||
else
|
||||
{
|
||||
efl_animation_object_scale_absolute_set(anim_obj,
|
||||
pd->from.scale_x, pd->from.scale_y,
|
||||
pd->to.scale_x, pd->to.scale_y,
|
||||
efl_gfx_map_zoom_absolute(target,
|
||||
new_scale.scale_x / prev_scale.scale_x,
|
||||
new_scale.scale_y / prev_scale.scale_y,
|
||||
pd->abs_pivot.cx, pd->abs_pivot.cy);
|
||||
}
|
||||
|
||||
return anim_obj;
|
||||
return progress;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
|
@ -248,6 +186,8 @@ _efl_animation_scale_efl_object_constructor(Eo *eo_obj,
|
|||
|
||||
pd->from.scale_x = 1.0;
|
||||
pd->from.scale_y = 1.0;
|
||||
pd->to.scale_x = 1.0;
|
||||
pd->to.scale_y = 1.0;
|
||||
|
||||
pd->rel_pivot.obj = NULL;
|
||||
pd->rel_pivot.cx = 0.5;
|
||||
|
|
|
@ -39,6 +39,6 @@ class Efl.Animation.Scale (Efl.Animation)
|
|||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Animation.object_create;
|
||||
Efl.Animation.animation_apply;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_SCALE_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
#include "efl_animation_private.h"
|
||||
|
||||
#define EFL_ANIMATION_SCALE_DATA_GET(o, pd) \
|
||||
Efl_Animation_Scale_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_SCALE_CLASS)
|
||||
|
|
|
@ -1,7 +1,32 @@
|
|||
#include "efl_animation_translate_private.h"
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_TRANSLATE_CLASS
|
||||
|
||||
typedef struct __Translate_Property_Double
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
} _Translate_Property_Double;
|
||||
|
||||
static _Translate_Property_Double
|
||||
_translation_get(Eo *target)
|
||||
{
|
||||
double x1, x2, y1, y2;
|
||||
_Translate_Property_Double translate;
|
||||
Eina_Rect geometry;
|
||||
|
||||
geometry = efl_gfx_geometry_get(target);
|
||||
|
||||
efl_gfx_map_coord_absolute_get(target, 0, &x1, &y1, NULL);
|
||||
efl_gfx_map_coord_absolute_get(target, 2, &x2, &y2, NULL);
|
||||
translate.x = ((x1 + x2) / 2.0) - (geometry.x + (geometry.w / 2.0));
|
||||
translate.y = ((y1 + y2) / 2.0) - (geometry.y + (geometry.h / 2.0));
|
||||
|
||||
return translate;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_translate_translate_set(Eo *eo_obj,
|
||||
_efl_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Translate_Data *pd,
|
||||
Evas_Coord from_x,
|
||||
Evas_Coord from_y,
|
||||
|
@ -14,46 +39,21 @@ _efl_animation_translate_translate_set(Eo *eo_obj,
|
|||
pd->to.move_x = to_x;
|
||||
pd->to.move_y = to_y;
|
||||
|
||||
//Update absolute coordinate based on relative move
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, NULL, NULL);
|
||||
|
||||
pd->from.x = pd->from.move_x + x;
|
||||
pd->from.y = pd->from.move_y + y;
|
||||
|
||||
pd->to.x = pd->to.move_x + x;
|
||||
pd->to.y = pd->to.move_y + y;
|
||||
|
||||
pd->use_rel_move = EINA_TRUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_translate_translate_get(Eo *eo_obj,
|
||||
_efl_animation_translate_translate_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Translate_Data *pd,
|
||||
Evas_Coord *from_x,
|
||||
Evas_Coord *from_y,
|
||||
Evas_Coord *to_x,
|
||||
Evas_Coord *to_y)
|
||||
{
|
||||
//Update relative move based on absolute coordinate
|
||||
if (!pd->use_rel_move)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, NULL, NULL);
|
||||
|
||||
pd->from.move_x = pd->from.x - x;
|
||||
pd->from.move_y = pd->from.y - y;
|
||||
|
||||
pd->to.move_x = pd->to.x - x;
|
||||
pd->to.move_y = pd->to.y - y;
|
||||
ERR("Animation is done in absolute value.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (from_x)
|
||||
|
@ -68,7 +68,7 @@ _efl_animation_translate_translate_get(Eo *eo_obj,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_translate_translate_absolute_set(Eo *eo_obj,
|
||||
_efl_animation_translate_translate_absolute_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Translate_Data *pd,
|
||||
Evas_Coord from_x,
|
||||
Evas_Coord from_y,
|
||||
|
@ -81,46 +81,21 @@ _efl_animation_translate_translate_absolute_set(Eo *eo_obj,
|
|||
pd->to.x = to_x;
|
||||
pd->to.y = to_y;
|
||||
|
||||
//Update relative move based on absolute coordinate
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, NULL, NULL);
|
||||
|
||||
pd->from.move_x = pd->from.x - x;
|
||||
pd->from.move_y = pd->from.y - y;
|
||||
|
||||
pd->to.move_x = pd->to.x - x;
|
||||
pd->to.move_y = pd->to.y - y;
|
||||
|
||||
pd->use_rel_move = EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_animation_translate_translate_absolute_get(Eo *eo_obj,
|
||||
_efl_animation_translate_translate_absolute_get(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Animation_Translate_Data *pd,
|
||||
Evas_Coord *from_x,
|
||||
Evas_Coord *from_y,
|
||||
Evas_Coord *to_x,
|
||||
Evas_Coord *to_y)
|
||||
{
|
||||
//Update absolute coordinate based on relative move
|
||||
if (pd->use_rel_move)
|
||||
{
|
||||
Evas_Coord x = 0;
|
||||
Evas_Coord y = 0;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
if (target)
|
||||
evas_object_geometry_get(target, &x, &y, NULL, NULL);
|
||||
|
||||
pd->from.x = pd->from.move_x + x;
|
||||
pd->from.y = pd->from.move_y + y;
|
||||
|
||||
pd->to.x = pd->to.move_x + x;
|
||||
pd->to.y = pd->to.move_y + y;
|
||||
ERR("Animation is done in absolute value.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (from_x)
|
||||
|
@ -134,53 +109,33 @@ _efl_animation_translate_translate_absolute_get(Eo *eo_obj,
|
|||
*to_y = pd->to.y;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Animation_Object *
|
||||
_efl_animation_translate_efl_animation_object_create(Eo *eo_obj,
|
||||
Efl_Animation_Translate_Data *pd)
|
||||
EOLIAN static double
|
||||
_efl_animation_translate_efl_animation_animation_apply(Eo *eo_obj,
|
||||
Efl_Animation_Translate_Data *pd,
|
||||
double progress,
|
||||
Efl_Canvas_Object *target)
|
||||
{
|
||||
Efl_Animation_Object_Translate *anim_obj
|
||||
= efl_add(EFL_ANIMATION_OBJECT_TRANSLATE_CLASS, NULL);
|
||||
_Translate_Property_Double prev;
|
||||
_Translate_Property_Double new;
|
||||
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(eo_obj);
|
||||
efl_animation_object_target_set(anim_obj, target);
|
||||
|
||||
Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
|
||||
efl_animation_object_final_state_keep_set(anim_obj, state_keep);
|
||||
|
||||
double duration = efl_animation_duration_get(eo_obj);
|
||||
efl_animation_object_duration_set(anim_obj, duration);
|
||||
|
||||
double start_delay_time = efl_animation_start_delay_get(eo_obj);
|
||||
efl_animation_object_start_delay_set(anim_obj, start_delay_time);
|
||||
|
||||
Efl_Animation_Object_Repeat_Mode repeat_mode =
|
||||
(Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
|
||||
efl_animation_object_repeat_mode_set(anim_obj, repeat_mode);
|
||||
|
||||
int repeat_count = efl_animation_repeat_count_get(eo_obj);
|
||||
efl_animation_object_repeat_count_set(anim_obj, repeat_count);
|
||||
|
||||
Efl_Interpolator *interpolator = efl_animation_interpolator_get(eo_obj);
|
||||
efl_animation_object_interpolator_set(anim_obj, interpolator);
|
||||
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
|
||||
if (!target) return progress;
|
||||
|
||||
prev = _translation_get(target);
|
||||
if (pd->use_rel_move)
|
||||
{
|
||||
efl_animation_object_translate_set(anim_obj,
|
||||
pd->from.move_x,
|
||||
pd->from.move_y,
|
||||
pd->to.move_x,
|
||||
pd->to.move_y);
|
||||
new.x = GET_STATUS(pd->from.move_x, pd->to.move_x, progress);
|
||||
new.y = GET_STATUS(pd->from.move_y, pd->to.move_y, progress);
|
||||
}
|
||||
else
|
||||
{
|
||||
efl_animation_object_translate_absolute_set(anim_obj,
|
||||
pd->from.x,
|
||||
pd->from.y,
|
||||
pd->to.x,
|
||||
pd->to.y);
|
||||
new.x = GET_STATUS(pd->from.x, pd->to.x, progress);
|
||||
new.y = GET_STATUS(pd->from.y, pd->to.y, progress);
|
||||
}
|
||||
|
||||
return anim_obj;
|
||||
efl_gfx_map_translate(target, new.x - prev.x, new.y - prev.y, 0.0);
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Object *
|
||||
|
|
|
@ -34,6 +34,6 @@ class Efl.Animation.Translate (Efl.Animation)
|
|||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Animation.object_create;
|
||||
Efl.Animation.animation_apply;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
#include "evas_common_private.h"
|
||||
#include <Ecore.h>
|
||||
|
||||
#define MY_CLASS EFL_ANIMATION_TRANSLATE_CLASS
|
||||
#define MY_CLASS_NAME efl_class_name_get(MY_CLASS)
|
||||
#include "efl_animation_private.h"
|
||||
|
||||
#define EFL_ANIMATION_TRANSLATE_DATA_GET(o, pd) \
|
||||
Efl_Animation_Translate_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_TRANSLATE_CLASS)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// All the below types are for Efl Animation
|
||||
|
||||
struct Efl.Animation.Object.Running_Event_Info; [[Information of running event]]
|
||||
struct Efl.Animation.Player.Running_Event_Info; [[Information of running event]]
|
||||
|
||||
enum Efl.Animation.Repeat_Mode
|
||||
{
|
||||
|
|
|
@ -106,11 +106,7 @@ _evas_object_intercept_call_internal(Evas_Object *eo_obj,
|
|||
/* If show is called during hide animation is running, then the
|
||||
* current hide animation is cancelled and show operation is
|
||||
* proceeded. */
|
||||
if (i &&
|
||||
_efl_canvas_object_event_animation_is_running(eo_obj,
|
||||
EFL_GFX_EVENT_HIDE))
|
||||
_efl_canvas_object_event_animation_cancel(eo_obj);
|
||||
else
|
||||
if ((!obj->anim_player) || (!efl_player_play_get(obj->anim_player)))
|
||||
return 1;
|
||||
}
|
||||
if (!obj->interceptors) return 0;
|
||||
|
|
|
@ -53,10 +53,6 @@ typedef struct _Event_Animation
|
|||
const Efl_Event_Description *desc;
|
||||
|
||||
Efl_Animation *anim;
|
||||
Efl_Animation_Object *anim_obj;
|
||||
|
||||
Eina_Bool hide_anim_started : 1;
|
||||
Eina_Bool hide_anim_ended : 1;
|
||||
} Event_Animation;
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -178,80 +174,57 @@ _evas_object_pointer_data_get(Evas_Pointer_Data *evas_pdata,
|
|||
}
|
||||
|
||||
static void _animation_intercept_hide(void *data, Evas_Object *eo_obj);
|
||||
static void _hide(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj);
|
||||
|
||||
static void
|
||||
_animation_hide_end_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
_animation_end_cb(void *data, const Efl_Event *event)
|
||||
{
|
||||
Evas_Object_Protected_Data *obj;
|
||||
Event_Animation *event_anim = data;
|
||||
|
||||
event_anim->hide_anim_ended = EINA_TRUE;
|
||||
obj = EVAS_OBJECT_DATA_SAFE_GET(efl_animation_player_target_get(event->object));
|
||||
if (!obj) return;
|
||||
|
||||
//Animation Object is automatically deleted when animation is ended.
|
||||
event_anim->anim_obj = NULL;
|
||||
if (efl_animation_player_animation_get(event->object) != event_anim->anim)
|
||||
return;
|
||||
|
||||
Evas_Object *target = efl_animation_target_get(event_anim->anim);
|
||||
_animation_intercept_hide(event_anim, target);
|
||||
|
||||
event_anim->hide_anim_started = EINA_FALSE;
|
||||
event_anim->hide_anim_ended = EINA_FALSE;
|
||||
_hide(obj->object, obj);
|
||||
}
|
||||
|
||||
static void _all_animation_objects_cancel(Evas_Object_Protected_Data *obj);
|
||||
|
||||
static void
|
||||
_animation_intercept_hide(void *data, Evas_Object *eo_obj)
|
||||
{
|
||||
Event_Animation *event_anim = data;
|
||||
Evas_Object_Protected_Data *obj = EVAS_OBJECT_DATA_SAFE_GET(eo_obj);
|
||||
|
||||
if (event_anim->anim &&
|
||||
!event_anim->hide_anim_started && !event_anim->hide_anim_ended)
|
||||
if (event_anim->anim && obj->anim_player &&
|
||||
(event_anim->anim != efl_animation_player_animation_get(obj->anim_player)))
|
||||
{
|
||||
event_anim->hide_anim_started = EINA_TRUE;
|
||||
|
||||
if (obj) _all_animation_objects_cancel(obj);
|
||||
|
||||
//Create animation object to start animation
|
||||
event_anim->anim_obj = efl_animation_object_create(event_anim->anim);
|
||||
|
||||
efl_event_callback_add(event_anim->anim_obj,
|
||||
EFL_ANIMATION_OBJECT_EVENT_ENDED,
|
||||
_animation_hide_end_cb,
|
||||
event_anim);
|
||||
|
||||
efl_animation_player_animation_set(obj->anim_player, event_anim->anim);
|
||||
//Start animation
|
||||
efl_animation_object_start(event_anim->anim_obj);
|
||||
efl_player_start(obj->anim_player);
|
||||
}
|
||||
else
|
||||
efl_gfx_visible_set(eo_obj, EINA_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
_event_anim_free(Event_Animation *event_anim)
|
||||
_event_anim_free(Event_Animation *event_anim, Evas_Object_Protected_Data *obj)
|
||||
{
|
||||
if (event_anim->anim)
|
||||
{
|
||||
//Deallocate memory and Unset callbacks for Hide event
|
||||
if (event_anim->desc == EFL_GFX_EVENT_HIDE)
|
||||
{
|
||||
Efl_Canvas_Object *target =
|
||||
efl_animation_target_get(event_anim->anim);
|
||||
|
||||
evas_object_intercept_hide_callback_del(target,
|
||||
evas_object_intercept_hide_callback_del(obj->object,
|
||||
_animation_intercept_hide);
|
||||
|
||||
if (event_anim->hide_anim_started &&
|
||||
!event_anim->hide_anim_ended)
|
||||
efl_gfx_visible_set(target, EINA_FALSE);
|
||||
efl_event_callback_del(obj->anim_player,
|
||||
EFL_ANIMATION_PLAYER_EVENT_ENDED,
|
||||
_animation_end_cb,
|
||||
event_anim);
|
||||
if (efl_player_play_get(obj->anim_player))
|
||||
efl_gfx_visible_set(obj->object, EINA_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (event_anim->anim_obj)
|
||||
{
|
||||
efl_del(event_anim->anim_obj);
|
||||
event_anim->anim_obj = NULL;
|
||||
}
|
||||
|
||||
free(event_anim);
|
||||
}
|
||||
|
||||
|
@ -595,18 +568,6 @@ evas_object_free(Evas_Object *eo_obj, Eina_Bool clean_layer)
|
|||
eina_cow_free(evas_object_mask_cow, (const Eina_Cow_Data**) &obj->mask);
|
||||
eina_cow_free(evas_object_events_cow, (const Eina_Cow_Data**) &obj->events);
|
||||
|
||||
//Free event animations
|
||||
while (obj->event_anims)
|
||||
{
|
||||
Event_Animation *event_anim =
|
||||
EINA_INLIST_CONTAINER_GET(obj->event_anims, Event_Animation);
|
||||
|
||||
obj->event_anims =
|
||||
eina_inlist_remove(obj->event_anims, obj->event_anims);
|
||||
|
||||
_event_anim_free(event_anim);
|
||||
}
|
||||
|
||||
efl_data_unref(eo_obj, obj->private_data);
|
||||
obj->private_data = NULL;
|
||||
|
||||
|
@ -1133,17 +1094,6 @@ _is_event_blocked(Eo *eo_obj, const Efl_Event_Description *desc,
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_efl_animation_event_type_is_inform_call(const Efl_Event_Description *desc)
|
||||
{
|
||||
if ((desc == EFL_GFX_EVENT_SHOW) || (desc == EFL_GFX_EVENT_HIDE) ||
|
||||
(desc == EFL_GFX_EVENT_MOVE) || (desc == EFL_GFX_EVENT_RESIZE) ||
|
||||
(desc == EFL_GFX_EVENT_CHANGE_SIZE_HINTS))
|
||||
return EINA_TRUE;
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static Event_Animation *
|
||||
_event_animation_find(Evas_Object_Protected_Data *obj,
|
||||
const Efl_Event_Description *desc)
|
||||
|
@ -1157,43 +1107,6 @@ _event_animation_find(Evas_Object_Protected_Data *obj,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static Efl_Animation_Object *
|
||||
_event_animation_object_get(Evas_Object_Protected_Data *obj,
|
||||
const Efl_Event_Description *desc)
|
||||
{
|
||||
Event_Animation *event_anim = _event_animation_find(obj, desc);
|
||||
if (event_anim && event_anim->anim_obj)
|
||||
return event_anim->anim_obj;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
_all_animation_objects_cancel(Evas_Object_Protected_Data *obj)
|
||||
{
|
||||
if (obj->event_anims)
|
||||
{
|
||||
Event_Animation *event_anim;
|
||||
EINA_INLIST_FOREACH(obj->event_anims, event_anim)
|
||||
{
|
||||
if (event_anim && event_anim->anim_obj)
|
||||
{
|
||||
efl_animation_object_cancel(event_anim->anim_obj);
|
||||
event_anim->anim_obj = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_animation_end_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
Event_Animation *event_anim = data;
|
||||
|
||||
//Animation Object is automatically deleted when animation is ended.
|
||||
event_anim->anim_obj = NULL;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_canvas_object_efl_object_event_callback_call(Eo *eo_obj,
|
||||
Evas_Object_Protected_Data *obj,
|
||||
|
@ -1205,24 +1118,16 @@ _efl_canvas_object_efl_object_event_callback_call(Eo *eo_obj,
|
|||
//Start animation corresponding to the current event
|
||||
if (desc)
|
||||
{
|
||||
if (!_efl_animation_event_type_is_inform_call(desc))
|
||||
if ((desc != EFL_GFX_EVENT_HIDE) && desc != (EFL_GFX_EVENT_SHOW))
|
||||
{
|
||||
Event_Animation *event_anim = _event_animation_find(obj, desc);
|
||||
if (event_anim)
|
||||
{
|
||||
_all_animation_objects_cancel(obj);
|
||||
|
||||
//Create animation object to start animation
|
||||
event_anim->anim_obj =
|
||||
efl_animation_object_create(event_anim->anim);
|
||||
|
||||
efl_event_callback_add(event_anim->anim_obj,
|
||||
EFL_ANIMATION_OBJECT_EVENT_ENDED,
|
||||
_animation_end_cb,
|
||||
event_anim);
|
||||
efl_animation_player_animation_set(obj->anim_player, event_anim->anim);
|
||||
|
||||
//Start animation
|
||||
efl_animation_object_start(event_anim->anim_obj);
|
||||
efl_player_start(obj->anim_player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1242,24 +1147,16 @@ _efl_canvas_object_efl_object_event_callback_legacy_call(Eo *eo_obj,
|
|||
//Start animation corresponding to the current event
|
||||
if (desc)
|
||||
{
|
||||
if (!_efl_animation_event_type_is_inform_call(desc))
|
||||
if ((desc != EFL_GFX_EVENT_HIDE) && desc != (EFL_GFX_EVENT_SHOW))
|
||||
{
|
||||
Event_Animation *event_anim = _event_animation_find(obj, desc);
|
||||
if (event_anim)
|
||||
{
|
||||
_all_animation_objects_cancel(obj);
|
||||
|
||||
//Create animation object to start animation
|
||||
event_anim->anim_obj =
|
||||
efl_animation_object_create(event_anim->anim);
|
||||
|
||||
efl_event_callback_add(event_anim->anim_obj,
|
||||
EFL_ANIMATION_OBJECT_EVENT_ENDED,
|
||||
_animation_end_cb,
|
||||
event_anim);
|
||||
efl_animation_player_animation_set(obj->anim_player, event_anim->anim);
|
||||
|
||||
//Start animation
|
||||
efl_animation_object_start(event_anim->anim_obj);
|
||||
efl_player_start(obj->anim_player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1362,6 +1259,18 @@ _efl_canvas_object_efl_object_destructor(Eo *eo_obj, Evas_Object_Protected_Data
|
|||
if (obj->cur->clipper) evas_object_clip_unset(eo_obj);
|
||||
_efl_canvas_object_clip_prev_reset(obj, EINA_FALSE);
|
||||
|
||||
//Free event animations
|
||||
while (obj->event_anims)
|
||||
{
|
||||
Event_Animation *event_anim =
|
||||
EINA_INLIST_CONTAINER_GET(obj->event_anims, Event_Animation);
|
||||
|
||||
obj->event_anims =
|
||||
eina_inlist_remove(obj->event_anims, obj->event_anims);
|
||||
|
||||
_event_anim_free(event_anim, obj);
|
||||
}
|
||||
|
||||
evas_object_map_set(eo_obj, NULL);
|
||||
if (obj->is_smart) evas_object_smart_del(eo_obj);
|
||||
event_id = _evas_object_event_new();
|
||||
|
@ -1929,6 +1838,8 @@ evas_object_visible_get(const Evas_Object *obj)
|
|||
static void
|
||||
_show(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
|
||||
{
|
||||
if (obj->anim_player)
|
||||
efl_player_stop(obj->anim_player);
|
||||
if (obj->is_smart && obj->smart.smart && obj->smart.smart->smart_class->show)
|
||||
{
|
||||
obj->smart.smart->smart_class->show(eo_obj);
|
||||
|
@ -1965,19 +1876,11 @@ _show(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
|
|||
Event_Animation *event_anim = _event_animation_find(obj, EFL_GFX_EVENT_SHOW);
|
||||
if (event_anim)
|
||||
{
|
||||
_all_animation_objects_cancel(obj);
|
||||
|
||||
//Create animation object to start animation
|
||||
event_anim->anim_obj =
|
||||
efl_animation_object_create(event_anim->anim);
|
||||
|
||||
efl_event_callback_add(event_anim->anim_obj,
|
||||
EFL_ANIMATION_OBJECT_EVENT_ENDED,
|
||||
_animation_end_cb,
|
||||
event_anim);
|
||||
efl_animation_player_animation_set(obj->anim_player, event_anim->anim);
|
||||
|
||||
//Start animation
|
||||
efl_animation_object_start(event_anim->anim_obj);
|
||||
efl_player_start(obj->anim_player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2098,7 +2001,6 @@ _efl_canvas_object_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Protected_Data *o
|
|||
{
|
||||
if (!obj->legacy.visible_set)
|
||||
obj->legacy.visible_set = EINA_TRUE;
|
||||
|
||||
if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 1, vis))
|
||||
return;
|
||||
|
||||
|
@ -2760,6 +2662,12 @@ _efl_canvas_object_event_animation_set(Eo *eo_obj,
|
|||
{
|
||||
Event_Animation *event_anim = _event_animation_find(pd, desc);
|
||||
|
||||
if (!pd->anim_player)
|
||||
{
|
||||
pd->anim_player = efl_add(EFL_ANIMATION_PLAYER_CLASS, eo_obj,
|
||||
efl_animation_player_target_set(efl_added, eo_obj));
|
||||
}
|
||||
|
||||
if (event_anim)
|
||||
{
|
||||
if (event_anim->anim == animation)
|
||||
|
@ -2768,32 +2676,27 @@ _efl_canvas_object_event_animation_set(Eo *eo_obj,
|
|||
pd->event_anims =
|
||||
eina_inlist_remove(pd->event_anims, EINA_INLIST_GET(event_anim));
|
||||
|
||||
_event_anim_free(event_anim);
|
||||
_event_anim_free(event_anim, pd);
|
||||
}
|
||||
|
||||
if (!animation) return;
|
||||
|
||||
event_anim = calloc(1, sizeof(Event_Animation));
|
||||
|
||||
//Set target object for the given animation
|
||||
Efl_Canvas_Object *target = efl_animation_target_get(animation);
|
||||
if (!target)
|
||||
target = eo_obj;
|
||||
efl_animation_target_set(animation, target);
|
||||
|
||||
//Set callback for Hide event
|
||||
if (desc == EFL_GFX_EVENT_HIDE)
|
||||
{
|
||||
evas_object_intercept_hide_callback_add(target,
|
||||
evas_object_intercept_hide_callback_add(eo_obj,
|
||||
_animation_intercept_hide,
|
||||
event_anim);
|
||||
efl_event_callback_add(pd->anim_player,
|
||||
EFL_ANIMATION_PLAYER_EVENT_ENDED,
|
||||
_animation_end_cb,
|
||||
event_anim);
|
||||
}
|
||||
|
||||
event_anim->desc = desc;
|
||||
event_anim->anim = animation;
|
||||
event_anim->anim_obj = NULL;
|
||||
event_anim->hide_anim_started = EINA_FALSE;
|
||||
event_anim->hide_anim_ended = EINA_FALSE;
|
||||
|
||||
pd->event_anims =
|
||||
eina_inlist_append(pd->event_anims, EINA_INLIST_GET(event_anim));
|
||||
|
@ -2805,38 +2708,21 @@ _efl_canvas_object_event_animation_get(Eo *eo_obj EINA_UNUSED,
|
|||
const Efl_Event_Description *desc)
|
||||
{
|
||||
Event_Animation *event_anim = _event_animation_find(pd, desc);
|
||||
if (event_anim && event_anim->anim)
|
||||
return event_anim->anim_obj;
|
||||
if (event_anim)
|
||||
return event_anim->anim;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This function is to show object if show is called during hide animation.
|
||||
* If show is called during hide animation is running, then the running hide
|
||||
* animation is cancelled and show operation is proceeded. */
|
||||
Eina_Bool
|
||||
_efl_canvas_object_event_animation_is_running(Eo *eo_obj,
|
||||
const Efl_Event_Description *desc)
|
||||
{
|
||||
Evas_Object_Protected_Data *obj = EVAS_OBJECT_DATA_SAFE_GET(eo_obj);
|
||||
|
||||
if (!obj) return EINA_FALSE;
|
||||
|
||||
if (_event_animation_object_get(obj, desc))
|
||||
return EINA_TRUE;
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_efl_canvas_object_event_animation_cancel(Eo *eo_obj)
|
||||
{
|
||||
Evas_Object_Protected_Data *obj = EVAS_OBJECT_DATA_SAFE_GET(eo_obj);
|
||||
|
||||
if (obj) _all_animation_objects_cancel(obj);
|
||||
if (obj)
|
||||
efl_player_stop(obj->anim_player);
|
||||
}
|
||||
|
||||
|
||||
/* legacy */
|
||||
|
||||
EAPI const char *
|
||||
|
|
|
@ -1130,6 +1130,8 @@ struct _Evas_Object_Protected_Data
|
|||
// Pointer to the Evas_Object itself
|
||||
Evas_Object *object;
|
||||
|
||||
Evas_Object *anim_player;
|
||||
|
||||
Evas_Size_Hints *size_hints;
|
||||
|
||||
int last_mouse_down_counter;
|
||||
|
@ -1877,10 +1879,6 @@ void _evas_touch_point_remove(Evas *e, int id);
|
|||
void _evas_device_cleanup(Evas *e);
|
||||
Evas_Device *_evas_device_top_get(const Evas *e);
|
||||
|
||||
/* to show object if show is called during hide animation */
|
||||
Eina_Bool _efl_canvas_object_event_animation_is_running(Eo *eo_obj, const Efl_Event_Description *desc);
|
||||
void _efl_canvas_object_event_animation_cancel(Eo *eo_obj);
|
||||
|
||||
/* legacy/eo events */
|
||||
void *efl_input_pointer_legacy_info_fill(Evas *eo_evas, Efl_Input_Key *eo_ev, Evas_Callback_Type type, Evas_Event_Flags **pflags);
|
||||
void *efl_input_key_legacy_info_fill(Efl_Input_Key *evt, Evas_Event_Flags **pflags);
|
||||
|
|
Loading…
Reference in New Issue