forked from enlightenment/efl
Compare commits
6 Commits
master
...
devs/bu5hm
Author | SHA1 | Date |
---|---|---|
Xavi Artigas | ebeacfffda | |
Marcel Hollerbach | 7424b86fb5 | |
Marcel Hollerbach | 09272d9aeb | |
Marcel Hollerbach | fc53f55eb7 | |
Marcel Hollerbach | 01f6cce01d | |
Marcel Hollerbach | 8c3c0a38fe |
|
@ -10,7 +10,7 @@ typedef struct _App_Data
|
||||||
Elm_Button *button;
|
Elm_Button *button;
|
||||||
|
|
||||||
Evas_Object *start_btn;
|
Evas_Object *start_btn;
|
||||||
Evas_Object *repeat_count_spin;
|
Evas_Object *play_count_spin;
|
||||||
Evas_Object *repeat_mode_spin;
|
Evas_Object *repeat_mode_spin;
|
||||||
|
|
||||||
Eina_Bool is_btn_visible;
|
Eina_Bool is_btn_visible;
|
||||||
|
@ -44,8 +44,8 @@ _anim_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||||
Efl_Canvas_Animation_Repeat_Mode repeat_mode = _anim_repeat_mode_get(ad->repeat_mode_spin);
|
Efl_Canvas_Animation_Repeat_Mode repeat_mode = _anim_repeat_mode_get(ad->repeat_mode_spin);
|
||||||
if (repeat_mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
|
if (repeat_mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
|
||||||
{
|
{
|
||||||
int repeat_count = elm_spinner_value_get(ad->repeat_count_spin);
|
int play_count = elm_spinner_value_get(ad->play_count_spin);
|
||||||
if (repeat_count % 2 == 1)
|
if (play_count % 2 == 0)
|
||||||
{
|
{
|
||||||
ad->is_btn_visible = !(ad->is_btn_visible);
|
ad->is_btn_visible = !(ad->is_btn_visible);
|
||||||
if (ad->is_btn_visible)
|
if (ad->is_btn_visible)
|
||||||
|
@ -54,7 +54,7 @@ _anim_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
||||||
elm_object_text_set(ad->start_btn, "Start Alpha Animation from 0.0 to 1.0");
|
elm_object_text_set(ad->start_btn, "Start Alpha Animation from 0.0 to 1.0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elm_object_disabled_set(ad->repeat_count_spin, EINA_FALSE);
|
elm_object_disabled_set(ad->play_count_spin, EINA_FALSE);
|
||||||
elm_object_disabled_set(ad->repeat_mode_spin, EINA_FALSE);
|
elm_object_disabled_set(ad->repeat_mode_spin, EINA_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,16 +78,16 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
||||||
|
|
||||||
ad->is_btn_visible = !(ad->is_btn_visible);
|
ad->is_btn_visible = !(ad->is_btn_visible);
|
||||||
|
|
||||||
int repeat_count = elm_spinner_value_get(ad->repeat_count_spin);
|
int play_count = elm_spinner_value_get(ad->play_count_spin);
|
||||||
elm_object_disabled_set(ad->repeat_count_spin, EINA_TRUE);
|
elm_object_disabled_set(ad->play_count_spin, EINA_TRUE);
|
||||||
|
|
||||||
Efl_Canvas_Animation_Repeat_Mode repeat_mode = _anim_repeat_mode_get(ad->repeat_mode_spin);
|
Efl_Canvas_Animation_Repeat_Mode repeat_mode = _anim_repeat_mode_get(ad->repeat_mode_spin);
|
||||||
elm_object_disabled_set(ad->repeat_mode_spin, EINA_TRUE);
|
elm_object_disabled_set(ad->repeat_mode_spin, EINA_TRUE);
|
||||||
|
|
||||||
if (ad->is_btn_visible)
|
if (ad->is_btn_visible)
|
||||||
{
|
{
|
||||||
//Set animation repeat count
|
//Set animation play count
|
||||||
efl_animation_repeat_count_set(ad->show_anim, repeat_count);
|
efl_animation_play_count_set(ad->show_anim, play_count);
|
||||||
|
|
||||||
//Set animation repeat mode
|
//Set animation repeat mode
|
||||||
efl_animation_repeat_mode_set(ad->show_anim, repeat_mode);
|
efl_animation_repeat_mode_set(ad->show_anim, repeat_mode);
|
||||||
|
@ -99,7 +99,7 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Set animation repeat count
|
//Set animation repeat count
|
||||||
efl_animation_repeat_count_set(ad->hide_anim, repeat_count);
|
efl_animation_play_count_set(ad->hide_anim, play_count);
|
||||||
|
|
||||||
//Set animation repeat mode
|
//Set animation repeat mode
|
||||||
efl_animation_repeat_mode_set(ad->hide_anim, repeat_mode);
|
efl_animation_repeat_mode_set(ad->hide_anim, repeat_mode);
|
||||||
|
@ -158,15 +158,15 @@ test_efl_anim_repeat(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
||||||
evas_object_move(start_btn, 100, 300);
|
evas_object_move(start_btn, 100, 300);
|
||||||
evas_object_show(start_btn);
|
evas_object_show(start_btn);
|
||||||
|
|
||||||
//Spinner to set animation repeat count
|
//Spinner to set animation play count
|
||||||
Evas_Object *repeat_count_spin = elm_spinner_add(win);
|
Evas_Object *play_count_spin = elm_spinner_add(win);
|
||||||
elm_spinner_label_format_set(repeat_count_spin, "Repeat Count: %d");
|
elm_spinner_label_format_set(play_count_spin, "Play Count (0 is infinite): %d");
|
||||||
elm_spinner_editable_set(repeat_count_spin, EINA_FALSE);
|
elm_spinner_editable_set(play_count_spin, EINA_FALSE);
|
||||||
elm_spinner_min_max_set(repeat_count_spin, 0, 3);
|
elm_spinner_min_max_set(play_count_spin, 0, 3);
|
||||||
elm_spinner_value_set(repeat_count_spin, 0);
|
elm_spinner_value_set(play_count_spin, 1);
|
||||||
evas_object_resize(repeat_count_spin, 200, 50);
|
evas_object_resize(play_count_spin, 200, 50);
|
||||||
evas_object_move(repeat_count_spin, 100, 350);
|
evas_object_move(play_count_spin, 100, 350);
|
||||||
evas_object_show(repeat_count_spin);
|
evas_object_show(play_count_spin);
|
||||||
|
|
||||||
//Spinner to set animation repeat mode
|
//Spinner to set animation repeat mode
|
||||||
Evas_Object *repeat_mode_spin = elm_spinner_add(win);
|
Evas_Object *repeat_mode_spin = elm_spinner_add(win);
|
||||||
|
@ -184,7 +184,7 @@ test_efl_anim_repeat(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
||||||
ad->show_anim = show_anim;
|
ad->show_anim = show_anim;
|
||||||
ad->hide_anim = hide_anim;
|
ad->hide_anim = hide_anim;
|
||||||
ad->start_btn = start_btn;
|
ad->start_btn = start_btn;
|
||||||
ad->repeat_count_spin = repeat_count_spin;
|
ad->play_count_spin = play_count_spin;
|
||||||
ad->repeat_mode_spin = repeat_mode_spin;
|
ad->repeat_mode_spin = repeat_mode_spin;
|
||||||
ad->is_btn_visible = EINA_TRUE;
|
ad->is_btn_visible = EINA_TRUE;
|
||||||
ad->button = btn;
|
ad->button = btn;
|
||||||
|
|
|
@ -118,7 +118,7 @@ main(void)
|
||||||
efl_animation_scale_set(efl_added, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(3.0, 3.0), scale_rect, EINA_VECTOR2(0.5, 0.5)),
|
efl_animation_scale_set(efl_added, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(3.0, 3.0), scale_rect, EINA_VECTOR2(0.5, 0.5)),
|
||||||
efl_animation_start_delay_set(efl_added, 5.0),
|
efl_animation_start_delay_set(efl_added, 5.0),
|
||||||
efl_animation_duration_set(efl_added, 2.0),
|
efl_animation_duration_set(efl_added, 2.0),
|
||||||
efl_animation_repeat_count_set(efl_added, EFL_ANIMATION_REPEAT_INFINITE)
|
efl_animation_play_count_set(efl_added, 0)
|
||||||
),
|
),
|
||||||
1.0, 0.0);
|
1.0, 0.0);
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ main(void)
|
||||||
efl_new(EFL_CANVAS_ANIMATION_SCALE_CLASS,
|
efl_new(EFL_CANVAS_ANIMATION_SCALE_CLASS,
|
||||||
efl_animation_scale_set(efl_added, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(3.0, 3.0), scale_rect2, EINA_VECTOR2(0.5, 0.5)),
|
efl_animation_scale_set(efl_added, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(3.0, 3.0), scale_rect2, EINA_VECTOR2(0.5, 0.5)),
|
||||||
efl_animation_duration_set(efl_added, 2.0),
|
efl_animation_duration_set(efl_added, 2.0),
|
||||||
efl_animation_repeat_count_set(efl_added, EFL_ANIMATION_REPEAT_INFINITE),
|
efl_animation_play_count_set(efl_added, 0),
|
||||||
efl_animation_repeat_mode_set(efl_added, EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
|
efl_animation_repeat_mode_set(efl_added, EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
|
||||||
),
|
),
|
||||||
1.0, 0.0);
|
1.0, 0.0);
|
||||||
|
@ -139,7 +139,7 @@ main(void)
|
||||||
efl_new(EFL_CANVAS_ANIMATION_SCALE_CLASS,
|
efl_new(EFL_CANVAS_ANIMATION_SCALE_CLASS,
|
||||||
efl_animation_scale_set(efl_added, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(3.0, 3.0), scale_rect3, EINA_VECTOR2(0.5, 0.5)),
|
efl_animation_scale_set(efl_added, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(3.0, 3.0), scale_rect3, EINA_VECTOR2(0.5, 0.5)),
|
||||||
efl_animation_duration_set(efl_added, 2.0),
|
efl_animation_duration_set(efl_added, 2.0),
|
||||||
efl_animation_repeat_count_set(efl_added, 3),
|
efl_animation_play_count_set(efl_added, 4),
|
||||||
efl_animation_repeat_mode_set(efl_added, EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
|
efl_animation_repeat_mode_set(efl_added, EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
|
||||||
),
|
),
|
||||||
1.0, 0.0);
|
1.0, 0.0);
|
||||||
|
@ -162,7 +162,7 @@ main(void)
|
||||||
efl_new(EFL_CANVAS_ANIMATION_SCALE_CLASS,
|
efl_new(EFL_CANVAS_ANIMATION_SCALE_CLASS,
|
||||||
efl_animation_scale_set(efl_added, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(5.0, 5.0), scale_rect5, EINA_VECTOR2(0.5, 0.5)),
|
efl_animation_scale_set(efl_added, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(5.0, 5.0), scale_rect5, EINA_VECTOR2(0.5, 0.5)),
|
||||||
efl_animation_duration_set(efl_added, 5.0),
|
efl_animation_duration_set(efl_added, 5.0),
|
||||||
efl_animation_repeat_count_set(efl_added, EFL_ANIMATION_REPEAT_INFINITE)
|
efl_animation_play_count_set(efl_added, 0)
|
||||||
),
|
),
|
||||||
1.0, 0.0);
|
1.0, 0.0);
|
||||||
d.current_speed = 1.0;
|
d.current_speed = 1.0;
|
||||||
|
|
|
@ -3482,12 +3482,6 @@ typedef Eo Efl_Animation_Group_Sequential;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EFL_ANIMATION_GROUP_DURATION_NONE -1
|
|
||||||
#define EFL_ANIMATION_PLAYER_GROUP_DURATION_NONE -1
|
|
||||||
|
|
||||||
#define EFL_ANIMATION_REPEAT_INFINITE -1
|
|
||||||
#define EFL_ANIMATION_PLAYER_REPEAT_INFINITE -1
|
|
||||||
|
|
||||||
// The below type are necessary for legacy API and need to be manually kept in sync with .eo file.
|
// The below type are necessary for legacy API and need to be manually kept in sync with .eo file.
|
||||||
#ifndef _EFL_INPUT_DEVICE_EO_CLASS_TYPE
|
#ifndef _EFL_INPUT_DEVICE_EO_CLASS_TYPE
|
||||||
#define _EFL_INPUT_DEVICE_EO_CLASS_TYPE
|
#define _EFL_INPUT_DEVICE_EO_CLASS_TYPE
|
||||||
|
|
|
@ -122,13 +122,6 @@ typedef Eo Efl_Canvas_Animation_Group_Sequential;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EFL_ANIMATION_GROUP_DURATION_NONE -1
|
|
||||||
#define EFL_ANIMATION_PLAYER_GROUP_DURATION_NONE -1
|
|
||||||
|
|
||||||
#define EFL_ANIMATION_REPEAT_INFINITE -1
|
|
||||||
#define EFL_ANIMATION_PLAYER_REPEAT_INFINITE -1
|
|
||||||
|
|
||||||
|
|
||||||
struct _Efl_Canvas_Animation_Player_Event_Running
|
struct _Efl_Canvas_Animation_Player_Event_Running
|
||||||
{
|
{
|
||||||
double progress;
|
double progress;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#include "efl_canvas_animation_private.h"
|
#include "efl_canvas_animation_private.h"
|
||||||
|
#include <math.h>
|
||||||
#define MY_CLASS EFL_CANVAS_ANIMATION_CLASS
|
#define MY_CLASS EFL_CANVAS_ANIMATION_CLASS
|
||||||
|
|
||||||
|
static double _standard_animation_time = 0.2; //in seconds
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_animation_duration_set(Eo *eo_obj EINA_UNUSED,
|
_efl_canvas_animation_duration_set(Eo *eo_obj EINA_UNUSED,
|
||||||
Efl_Canvas_Animation_Data *pd,
|
Efl_Canvas_Animation_Data *pd,
|
||||||
|
@ -50,19 +52,19 @@ _efl_canvas_animation_repeat_mode_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_A
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_animation_repeat_count_set(Eo *eo_obj EINA_UNUSED,
|
_efl_canvas_animation_play_count_set(Eo *eo_obj EINA_UNUSED,
|
||||||
Efl_Canvas_Animation_Data *pd,
|
Efl_Canvas_Animation_Data *pd,
|
||||||
int count)
|
int count)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_FALSE_RETURN(count >= EFL_ANIMATION_REPEAT_INFINITE);
|
EINA_SAFETY_ON_FALSE_RETURN(count >= 0);
|
||||||
|
|
||||||
pd->repeat_count = count;
|
pd->play_count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static int
|
EOLIAN static int
|
||||||
_efl_canvas_animation_repeat_count_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Data *pd)
|
_efl_canvas_animation_play_count_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Animation_Data *pd)
|
||||||
{
|
{
|
||||||
return pd->repeat_count;
|
return pd->play_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -113,13 +115,12 @@ _efl_canvas_animation_animation_apply(Eo *eo_obj,
|
||||||
EOLIAN static double
|
EOLIAN static double
|
||||||
_efl_canvas_animation_efl_playable_length_get(const Eo *eo_obj, Efl_Canvas_Animation_Data *pd EINA_UNUSED)
|
_efl_canvas_animation_efl_playable_length_get(const Eo *eo_obj, Efl_Canvas_Animation_Data *pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
if (efl_animation_repeat_count_get(eo_obj) == EFL_ANIMATION_REPEAT_INFINITE)
|
if (efl_animation_play_count_get(eo_obj) == 0)
|
||||||
{
|
{
|
||||||
//TODO: what's correct?
|
return INFINITY;
|
||||||
return (double)EFL_ANIMATION_REPEAT_INFINITE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (efl_animation_duration_get(eo_obj) * (efl_animation_repeat_count_get(eo_obj) + 1));
|
return (efl_animation_duration_get(eo_obj) * efl_animation_play_count_get(eo_obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
|
@ -134,4 +135,25 @@ _efl_canvas_animation_efl_playable_seekable_get(const Eo *eo_obj EINA_UNUSED, Ef
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EOLIAN static Efl_Object*
|
||||||
|
_efl_canvas_animation_efl_object_constructor(Eo *obj, Efl_Canvas_Animation_Data *pd)
|
||||||
|
{
|
||||||
|
pd->duration = _standard_animation_time;
|
||||||
|
pd->play_count = 1;
|
||||||
|
return efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_canvas_animation_default_duration_set(double animation_time)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_FALSE_RETURN(animation_time > 0.0);
|
||||||
|
_standard_animation_time = animation_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static double
|
||||||
|
_efl_canvas_animation_default_duration_get(void)
|
||||||
|
{
|
||||||
|
return _standard_animation_time;
|
||||||
|
}
|
||||||
|
|
||||||
#include "efl_canvas_animation.eo.c"
|
#include "efl_canvas_animation.eo.c"
|
||||||
|
|
|
@ -40,7 +40,7 @@ class @beta Efl.Canvas.Animation extends Efl.Object implements Efl.Playable
|
||||||
@property duration {
|
@property duration {
|
||||||
[[The duration of a single animation "run".
|
[[The duration of a single animation "run".
|
||||||
The @Efl.Playable.length implementation will return this duration adjusted by @.repeat_mode and
|
The @Efl.Playable.length implementation will return this duration adjusted by @.repeat_mode and
|
||||||
@.repeat_count.
|
@.play_count.
|
||||||
]]
|
]]
|
||||||
set {
|
set {
|
||||||
}
|
}
|
||||||
|
@ -61,13 +61,15 @@ class @beta Efl.Canvas.Animation extends Efl.Object implements Efl.Playable
|
||||||
mode: Efl.Canvas.Animation_Repeat_Mode(Efl.Canvas.Animation_Repeat_Mode.restart); [[Repeat mode.]]
|
mode: Efl.Canvas.Animation_Repeat_Mode(Efl.Canvas.Animation_Repeat_Mode.restart); [[Repeat mode.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property repeat_count {
|
@property play_count {
|
||||||
[[How many times to repeat an animation once it finishes.
|
[[How many times to play an animation.
|
||||||
$[0] means that the animation only plays once (it is not repeated) and is the default value.
|
$[1] means that the animation only plays once (it is not repeated), whereas $[2] will play it
|
||||||
$[-1] means that the animation is repeated forever.
|
again once it finishes the first time and then stop.
|
||||||
|
$[0] means that the animation is repeated forever.
|
||||||
|
@.repeat_mode controls the direction in which subsequent playbacks will run.
|
||||||
]]
|
]]
|
||||||
values {
|
values {
|
||||||
count: int(0); [[Repeat count.]]
|
count: int(1); [[Play count.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property start_delay {
|
@property start_delay {
|
||||||
|
@ -110,8 +112,17 @@ class @beta Efl.Canvas.Animation extends Efl.Object implements Efl.Playable
|
||||||
}
|
}
|
||||||
return: double; [[Final applied progress, after possible adjustments. See @.interpolator.]]
|
return: double; [[Final applied progress, after possible adjustments. See @.interpolator.]]
|
||||||
}
|
}
|
||||||
|
@property default_duration @static {
|
||||||
|
[[Duration that will be used by default on all animations unless another value
|
||||||
|
is set per object using @.duration.
|
||||||
|
]]
|
||||||
|
values {
|
||||||
|
animation_time : double; [[Default animation duration, in seconds.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
implements {
|
implements {
|
||||||
|
Efl.Object.constructor;
|
||||||
Efl.Playable.length { get; }
|
Efl.Playable.length { get; }
|
||||||
Efl.Playable.seekable { get; }
|
Efl.Playable.seekable { get; }
|
||||||
Efl.Playable.playable { get; }
|
Efl.Playable.playable { get; }
|
||||||
|
|
|
@ -8,10 +8,7 @@ _efl_canvas_animation_group_animation_add(Eo *eo_obj,
|
||||||
if (!animation) return;
|
if (!animation) return;
|
||||||
|
|
||||||
double duration = efl_animation_duration_get(efl_super(eo_obj, MY_CLASS));
|
double duration = efl_animation_duration_get(efl_super(eo_obj, MY_CLASS));
|
||||||
/* if group animation duration is available value, then the duration is
|
efl_animation_duration_set(animation, duration);
|
||||||
* propagated to its child. */
|
|
||||||
if (duration != EFL_ANIMATION_GROUP_DURATION_NONE)
|
|
||||||
efl_animation_duration_set(animation, duration);
|
|
||||||
|
|
||||||
Eina_Bool keep_final_state = efl_animation_final_state_keep_get(eo_obj);
|
Eina_Bool keep_final_state = efl_animation_final_state_keep_get(eo_obj);
|
||||||
efl_animation_final_state_keep_set(animation, keep_final_state);
|
efl_animation_final_state_keep_set(animation, keep_final_state);
|
||||||
|
@ -53,9 +50,8 @@ _efl_canvas_animation_group_efl_canvas_animation_duration_set(Eo *eo_obj,
|
||||||
Efl_Canvas_Animation_Group_Data *pd,
|
Efl_Canvas_Animation_Group_Data *pd,
|
||||||
double duration)
|
double duration)
|
||||||
{
|
{
|
||||||
if (duration == EFL_ANIMATION_GROUP_DURATION_NONE) goto end;
|
efl_animation_duration_set(efl_super(eo_obj, MY_CLASS), duration);
|
||||||
|
duration = efl_animation_duration_get(eo_obj);
|
||||||
if (duration < 0.0) return;
|
|
||||||
|
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Efl_Canvas_Animation *anim;
|
Efl_Canvas_Animation *anim;
|
||||||
|
@ -63,9 +59,6 @@ _efl_canvas_animation_group_efl_canvas_animation_duration_set(Eo *eo_obj,
|
||||||
{
|
{
|
||||||
efl_animation_duration_set(anim, duration);
|
efl_animation_duration_set(anim, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
|
||||||
efl_animation_duration_set(efl_super(eo_obj, MY_CLASS), duration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
@ -106,9 +99,6 @@ _efl_canvas_animation_group_efl_object_constructor(Eo *eo_obj,
|
||||||
|
|
||||||
pd->animations = NULL;
|
pd->animations = NULL;
|
||||||
|
|
||||||
//group animation does not affect its child duration by default.
|
|
||||||
efl_animation_duration_set(eo_obj, EFL_ANIMATION_GROUP_DURATION_NONE);
|
|
||||||
|
|
||||||
return eo_obj;
|
return eo_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,12 @@ abstract @beta Efl.Canvas.Animation_Group extends Efl.Canvas.Animation
|
||||||
@in animation: Efl.Canvas.Animation; [[Animation to remove from the group.]]
|
@in animation: Efl.Canvas.Animation; [[Animation to remove from the group.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
animations_get @const {
|
@property animations {
|
||||||
[[Gets the list of animations currently in the animation group.]]
|
[[All animations that are currently part of this group.]]
|
||||||
return: iterator<Efl.Canvas.Animation> @move; [[List of animations in the group.]]
|
get { }
|
||||||
|
values {
|
||||||
|
animations : iterator<Efl.Canvas.Animation> @move; [[The iterator carrying all animations of this group]]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
implements {
|
implements {
|
||||||
|
|
|
@ -10,7 +10,7 @@ typedef struct _Efl_Canvas_Animation_Data
|
||||||
double start_delay_time;
|
double start_delay_time;
|
||||||
|
|
||||||
Efl_Canvas_Animation_Repeat_Mode repeat_mode;
|
Efl_Canvas_Animation_Repeat_Mode repeat_mode;
|
||||||
int repeat_count;
|
int play_count;
|
||||||
|
|
||||||
Efl_Interpolator *interpolator;
|
Efl_Interpolator *interpolator;
|
||||||
|
|
||||||
|
@ -25,4 +25,4 @@ typedef struct _Efl_Canvas_Animation_Data
|
||||||
|
|
||||||
#define FINAL_STATE_IS_REVERSE(anim) \
|
#define FINAL_STATE_IS_REVERSE(anim) \
|
||||||
((efl_animation_repeat_mode_get(anim) == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE) && \
|
((efl_animation_repeat_mode_get(anim) == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE) && \
|
||||||
(efl_animation_repeat_count_get(anim) & 1))
|
(efl_animation_play_count_get(anim) & 1))
|
||||||
|
|
|
@ -5,9 +5,11 @@ struct @beta Efl.Canvas.Animation_Player_Event_Running; [[Information of event r
|
||||||
|
|
||||||
enum @beta Efl.Canvas.Animation_Repeat_Mode
|
enum @beta Efl.Canvas.Animation_Repeat_Mode
|
||||||
{
|
{
|
||||||
[[Animation repeat mode]]
|
[[Animation repeat mode.]]
|
||||||
|
|
||||||
restart = 0, [[Restart animation when the animation ends.]]
|
restart = 0, [[Restart animation when the animation ends: The animation will play again from the beginning to the
|
||||||
reverse = 1, [[Reverse animation when the animation ends.]]
|
end.]]
|
||||||
|
reverse = 1, [[Reverse animation when the animation ends: The animation will continue playing from the end to the
|
||||||
|
beginning.]]
|
||||||
last
|
last
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ _animator_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
(pd->in->speed > 0 && EINA_DBL_EQ(pd->in->progress, 1.0)))
|
(pd->in->speed > 0 && EINA_DBL_EQ(pd->in->progress, 1.0)))
|
||||||
{
|
{
|
||||||
//Repeat animation
|
//Repeat animation
|
||||||
if ((efl_animation_repeat_count_get(pd->in->animation) == EFL_ANIMATION_REPEAT_INFINITE) ||
|
if ((efl_animation_play_count_get(pd->in->animation) == 0) ||
|
||||||
(pd->in->remaining_repeats > 0))
|
(pd->in->remaining_repeats > 0))
|
||||||
{
|
{
|
||||||
pd->in->remaining_repeats--;
|
pd->in->remaining_repeats--;
|
||||||
|
@ -167,7 +167,7 @@ _efl_canvas_object_animation_animation_start(Eo *obj, Efl_Canvas_Object_Animatio
|
||||||
|
|
||||||
in->pause_state = EINA_FALSE;
|
in->pause_state = EINA_FALSE;
|
||||||
in->animation = efl_ref(animation);
|
in->animation = efl_ref(animation);
|
||||||
in->remaining_repeats = efl_animation_repeat_count_get(animation); // -1 because one run is already going on
|
in->remaining_repeats = efl_animation_play_count_get(animation) - 1; // -1 because one run is already going on
|
||||||
in->speed = speed;
|
in->speed = speed;
|
||||||
in->start_pos = start_pos;
|
in->start_pos = start_pos;
|
||||||
efl_event_callback_call(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, in->animation);
|
efl_event_callback_call(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, in->animation);
|
||||||
|
|
|
@ -34,7 +34,16 @@ EFL_START_TEST(efl_canvas_animation_negative_double_checking)
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
EFL_END_TEST
|
||||||
|
|
||||||
|
EFL_START_TEST(efl_canvas_animation_default_value)
|
||||||
|
{
|
||||||
|
Efl_Canvas_Animation *animation = efl_new(EFL_CANVAS_ANIMATION_CLASS);
|
||||||
|
|
||||||
|
fail_if(efl_animation_duration_get(animation) == 0.0);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
void efl_test_canvas_animation(TCase *tc)
|
void efl_test_canvas_animation(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_test(tc, efl_canvas_animation_negative_double_checking);
|
tcase_add_test(tc, efl_canvas_animation_negative_double_checking);
|
||||||
|
tcase_add_test(tc, efl_canvas_animation_default_value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue