Elm_Button *button;
Evas_Object *start_btn;
- Evas_Object *repeat_count_spin;
+ Evas_Object *play_count_spin;
Evas_Object *repeat_mode_spin;
Eina_Bool is_btn_visible;
Efl_Canvas_Animation_Repeat_Mode repeat_mode = _anim_repeat_mode_get(ad->repeat_mode_spin);
if (repeat_mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
{
- int repeat_count = elm_spinner_value_get(ad->repeat_count_spin);
- if (repeat_count % 2 == 1)
+ int play_count = elm_spinner_value_get(ad->play_count_spin);
+ if (play_count % 2 == 0)
{
ad->is_btn_visible = !(ad->is_btn_visible);
if (ad->is_btn_visible)
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);
}
}
ad->is_btn_visible = !(ad->is_btn_visible);
- int repeat_count = elm_spinner_value_get(ad->repeat_count_spin);
- elm_object_disabled_set(ad->repeat_count_spin, EINA_TRUE);
+ int play_count = elm_spinner_value_get(ad->play_count_spin);
+ 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);
elm_object_disabled_set(ad->repeat_mode_spin, EINA_TRUE);
if (ad->is_btn_visible)
{
- //Set animation repeat count
- efl_animation_repeat_count_set(ad->show_anim, repeat_count);
+ //Set animation play count
+ efl_animation_play_count_set(ad->show_anim, play_count);
//Set animation repeat mode
efl_animation_repeat_mode_set(ad->show_anim, repeat_mode);
else
{
//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
efl_animation_repeat_mode_set(ad->hide_anim, repeat_mode);
evas_object_move(start_btn, 100, 300);
evas_object_show(start_btn);
- //Spinner to set animation repeat count
- Evas_Object *repeat_count_spin = elm_spinner_add(win);
- elm_spinner_label_format_set(repeat_count_spin, "Repeat Count: %d");
- elm_spinner_editable_set(repeat_count_spin, EINA_FALSE);
- elm_spinner_min_max_set(repeat_count_spin, 0, 3);
- elm_spinner_value_set(repeat_count_spin, 0);
- evas_object_resize(repeat_count_spin, 200, 50);
- evas_object_move(repeat_count_spin, 100, 350);
- evas_object_show(repeat_count_spin);
+ //Spinner to set animation play count
+ Evas_Object *play_count_spin = elm_spinner_add(win);
+ elm_spinner_label_format_set(play_count_spin, "Play Count (0 is infinite): %d");
+ elm_spinner_editable_set(play_count_spin, EINA_FALSE);
+ elm_spinner_min_max_set(play_count_spin, 0, 3);
+ elm_spinner_value_set(play_count_spin, 1);
+ evas_object_resize(play_count_spin, 200, 50);
+ evas_object_move(play_count_spin, 100, 350);
+ evas_object_show(play_count_spin);
//Spinner to set animation repeat mode
Evas_Object *repeat_mode_spin = elm_spinner_add(win);
ad->show_anim = show_anim;
ad->hide_anim = hide_anim;
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->is_btn_visible = EINA_TRUE;
ad->button = btn;
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_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);
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_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)
),
1.0, 0.0);
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_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)
),
1.0, 0.0);
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_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);
d.current_speed = 1.0;
#endif
-#define EFL_ANIMATION_REPEAT_INFINITE -1
-
// 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
#define _EFL_INPUT_DEVICE_EO_CLASS_TYPE
#endif
-#define EFL_ANIMATION_REPEAT_INFINITE -1
-
struct _Efl_Canvas_Animation_Player_Event_Running
{
double progress;
}
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,
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
-_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 double
_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)
{
return INFINITY;
}
- 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
_efl_canvas_animation_efl_object_constructor(Eo *obj, Efl_Canvas_Animation_Data *pd)
{
pd->duration = _default_animation_time;
+ pd->play_count = 1;
return efl_constructor(efl_super(obj, MY_CLASS));
}
@property duration {
[[The duration of a single animation "run".
The @Efl.Playable.length implementation will return this duration adjusted by @.repeat_mode and
- @.repeat_count.
+ @.play_count.
]]
set {
}
mode: Efl.Canvas.Animation_Repeat_Mode(Efl.Canvas.Animation_Repeat_Mode.restart); [[Repeat mode.]]
}
}
- @property repeat_count {
- [[How many times to repeat an animation once it finishes.
- $[0] means that the animation only plays once (it is not repeated) and is the default value.
- $[-1] means that the animation is repeated forever.
+ @property play_count {
+ [[How many times to play an animation.
+ $[1] means that the animation only plays once (it is not repeated), whereas $[2] will play it
+ 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 {
- count: int(0); [[Repeat count.]]
+ count: int(1); [[Play count.]]
}
}
@property start_delay {
double start_delay_time;
Efl_Canvas_Animation_Repeat_Mode repeat_mode;
- int repeat_count;
+ int play_count;
Efl_Interpolator *interpolator;
#define FINAL_STATE_IS_REVERSE(anim) \
((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))
enum @beta Efl.Canvas.Animation_Repeat_Mode
{
- [[Animation repeat mode]]
+ [[Animation repeat mode.]]
- restart = 0, [[Restart animation when the animation ends.]]
- reverse = 1, [[Reverse animation when the animation ends.]]
+ restart = 0, [[Restart animation when the animation ends: The animation will play again from the beginning to the
+ end.]]
+ reverse = 1, [[Reverse animation when the animation ends: The animation will continue playing from the end to the
+ beginning.]]
last
}
(pd->in->speed > 0 && EINA_DBL_EQ(pd->in->progress, 1.0)))
{
//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--;
in->pause_state = EINA_FALSE;
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->start_pos = start_pos;
efl_event_callback_call(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, in->animation);