summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-02-25 13:52:40 +0900
committerHermet Park <hermetpark@gmail.com>2019-02-25 13:52:40 +0900
commitbdf39fc66957db24db3066b1b622e90f90330114 (patch)
tree3f3f43d815cbaf25962347b23808ecbb15ecbae8 /src
parent80d37a6de03fe4482bd104201a8744d1a4b0a0c2 (diff)
efl_ui_animation_view: replace naming, keyframe to progress.
To make consistency with Xamarin-Lottie interfaces, here replace the api. Progress is more clear to understand.
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_ui_animation_view.c42
-rw-r--r--src/lib/elementary/efl_ui_animation_view.eo10
-rw-r--r--src/lib/elementary/efl_ui_animation_view_private.h2
3 files changed, 27 insertions, 27 deletions
diff --git a/src/lib/elementary/efl_ui_animation_view.c b/src/lib/elementary/efl_ui_animation_view.c
index 174117f..6a60e1a 100644
--- a/src/lib/elementary/efl_ui_animation_view.c
+++ b/src/lib/elementary/efl_ui_animation_view.c
@@ -132,8 +132,8 @@ _transit_del_cb(Elm_Transit_Effect *effect, Elm_Transit *transit)
132{ 132{
133 Efl_Ui_Animation_View_Data *pd = (Efl_Ui_Animation_View_Data *) effect; 133 Efl_Ui_Animation_View_Data *pd = (Efl_Ui_Animation_View_Data *) effect;
134 134
135 if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY && pd->keyframe == 1) || 135 if ((pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY && pd->progress == 1) ||
136 (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK && pd->keyframe == 0)) 136 (pd->state == EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK && pd->progress == 0))
137 evas_object_smart_callback_call(pd->obj, SIG_PLAY_DONE, NULL); 137 evas_object_smart_callback_call(pd->obj, SIG_PLAY_DONE, NULL);
138 138
139 if (pd->transit != transit) return; 139 if (pd->transit != transit) return;
@@ -146,7 +146,7 @@ _transit_del_cb(Elm_Transit_Effect *effect, Elm_Transit *transit)
146 if (prev_state != EFL_UI_ANIMATION_VIEW_STATE_STOP) 146 if (prev_state != EFL_UI_ANIMATION_VIEW_STATE_STOP)
147 { 147 {
148 evas_object_smart_callback_call(pd->obj, SIG_PLAY_STOP, NULL); 148 evas_object_smart_callback_call(pd->obj, SIG_PLAY_STOP, NULL);
149 pd->keyframe = 0; 149 pd->progress = 0;
150 } 150 }
151} 151}
152 152
@@ -169,7 +169,7 @@ _transit_cb(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
169 } 169 }
170 else pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY; 170 else pd->state = EFL_UI_ANIMATION_VIEW_STATE_PLAY;
171 171
172 pd->keyframe = progress; 172 pd->progress = progress;
173 int minframe = (pd->frame_cnt - 1) * pd->min_progress; 173 int minframe = (pd->frame_cnt - 1) * pd->min_progress;
174 int maxframe = (pd->frame_cnt - 1) * pd->max_progress; 174 int maxframe = (pd->frame_cnt - 1) * pd->max_progress;
175 evas_object_vg_animated_frame_set(pd->vg, (int)((maxframe - minframe) * progress) + minframe); 175 evas_object_vg_animated_frame_set(pd->vg, (int)((maxframe - minframe) * progress) + minframe);
@@ -267,7 +267,7 @@ _ready_play(Efl_Ui_Animation_View_Data *pd)
267 elm_transit_object_add(transit, pd->vg); 267 elm_transit_object_add(transit, pd->vg);
268 if (pd->auto_repeat) elm_transit_repeat_times_set(transit, -1); 268 if (pd->auto_repeat) elm_transit_repeat_times_set(transit, -1);
269 elm_transit_effect_add(transit, _transit_cb, pd, _transit_del_cb); 269 elm_transit_effect_add(transit, _transit_cb, pd, _transit_del_cb);
270 elm_transit_progress_value_set(transit, pd->keyframe); 270 elm_transit_progress_value_set(transit, pd->progress);
271 elm_transit_objects_final_state_keep_set(transit, EINA_TRUE); 271 elm_transit_objects_final_state_keep_set(transit, EINA_TRUE);
272 pd->transit = transit; 272 pd->transit = transit;
273 if (pd->min_progress != 0.0 || pd->max_progress != 1.0) 273 if (pd->min_progress != 0.0 || pd->max_progress != 1.0)
@@ -287,7 +287,7 @@ _efl_ui_animation_view_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_V
287 287
288 if (pd->file) eina_stringshare_del(pd->file); 288 if (pd->file) eina_stringshare_del(pd->file);
289 pd->file = eina_stringshare_add(file); 289 pd->file = eina_stringshare_add(file);
290 pd->keyframe = 0; 290 pd->progress = 0;
291 291
292 _sizing_eval(pd); 292 _sizing_eval(pd);
293 293
@@ -407,7 +407,7 @@ _efl_ui_animation_view_play(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
407 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP) 407 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP)
408 _transit_go_facade(pd); 408 _transit_go_facade(pd);
409 else if (rewind) 409 else if (rewind)
410 elm_transit_progress_value_set(pd->transit, pd->keyframe); 410 elm_transit_progress_value_set(pd->transit, pd->progress);
411 411
412 return EINA_TRUE; 412 return EINA_TRUE;
413} 413}
@@ -422,7 +422,7 @@ _efl_ui_animation_view_stop(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
422 return EINA_FALSE; 422 return EINA_FALSE;
423 423
424 evas_object_vg_animated_frame_set(pd->vg, 0); 424 evas_object_vg_animated_frame_set(pd->vg, 0);
425 pd->keyframe = 0; 425 pd->progress = 0;
426 pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP; 426 pd->state = EFL_UI_ANIMATION_VIEW_STATE_STOP;
427 evas_object_smart_callback_call(pd->obj, SIG_PLAY_STOP, NULL); 427 evas_object_smart_callback_call(pd->obj, SIG_PLAY_STOP, NULL);
428 elm_transit_del(pd->transit); 428 elm_transit_del(pd->transit);
@@ -487,7 +487,7 @@ _efl_ui_animation_view_play_back(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data
487 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP) 487 if (pd->state == EFL_UI_ANIMATION_VIEW_STATE_STOP)
488 _transit_go_facade(pd); 488 _transit_go_facade(pd);
489 else if (rewind) 489 else if (rewind)
490 elm_transit_progress_value_set(pd->transit, 1 - pd->keyframe); 490 elm_transit_progress_value_set(pd->transit, 1 - pd->progress);
491 491
492 return EINA_TRUE; 492 return EINA_TRUE;
493} 493}
@@ -505,42 +505,42 @@ _efl_ui_animation_view_speed_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data
505} 505}
506 506
507EOLIAN static void 507EOLIAN static void
508_efl_ui_animation_view_keyframe_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double keyframe) 508_efl_ui_animation_view_progress_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, double progress)
509{ 509{
510 if (keyframe < 0) keyframe = 0; 510 if (progress < 0) progress = 0;
511 else if (keyframe > 1) keyframe = 1; 511 else if (progress > 1) progress = 1;
512 if (pd->keyframe == keyframe) return; 512 if (pd->progress == progress) return;
513 513
514 pd->keyframe = keyframe; 514 pd->progress = progress;
515 515
516 if (pd->frame_cnt > 0) 516 if (pd->frame_cnt > 0)
517 evas_object_vg_animated_frame_set(pd->vg, (int) ((pd->frame_cnt - 1) * keyframe)); 517 evas_object_vg_animated_frame_set(pd->vg, (int) ((pd->frame_cnt - 1) * progress));
518 518
519 if (pd->transit) 519 if (pd->transit)
520 { 520 {
521 if (pd->play_back) 521 if (pd->play_back)
522 elm_transit_progress_value_set(pd->transit, 1 - keyframe); 522 elm_transit_progress_value_set(pd->transit, 1 - progress);
523 else 523 else
524 elm_transit_progress_value_set(pd->transit, keyframe); 524 elm_transit_progress_value_set(pd->transit, progress);
525 } 525 }
526} 526}
527 527
528EOLIAN static double 528EOLIAN static double
529_efl_ui_animation_view_keyframe_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) 529_efl_ui_animation_view_progress_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
530{ 530{
531 return pd->keyframe; 531 return pd->progress;
532} 532}
533 533
534EOLIAN static void 534EOLIAN static void
535_efl_ui_animation_view_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int frame_num) 535_efl_ui_animation_view_frame_set(Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd, int frame_num)
536{ 536{
537 efl_ui_animation_view_keyframe_set(obj, (double) frame_num / (double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1)); 537 efl_ui_animation_view_progress_set(obj, (double) frame_num / (double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1));
538} 538}
539 539
540EOLIAN static int 540EOLIAN static int
541_efl_ui_animation_view_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd) 541_efl_ui_animation_view_frame_get(const Eo *obj EINA_UNUSED, Efl_Ui_Animation_View_Data *pd)
542{ 542{
543 return (int) ((double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1) * pd->keyframe); 543 return (int) ((double) (evas_object_vg_animated_frame_count_get(pd->vg) - 1) * pd->progress);
544} 544}
545 545
546EOLIAN static double 546EOLIAN static double
diff --git a/src/lib/elementary/efl_ui_animation_view.eo b/src/lib/elementary/efl_ui_animation_view.eo
index b1ec1e6..13ba560 100644
--- a/src/lib/elementary/efl_ui_animation_view.eo
+++ b/src/lib/elementary/efl_ui_animation_view.eo
@@ -76,19 +76,19 @@ class Efl.Ui.Animation_View extends Efl.Ui.Widget implements Efl.Gfx.View, Efl.F
76 frame_duration: double; [[duration time in the seconds]] 76 frame_duration: double; [[duration time in the seconds]]
77 } 77 }
78 } 78 }
79 @property keyframe { 79 @property progress {
80 [[Set current keyframe position of animation view. 80 [[Set current progress position of animation view.
81 81
82 When you required to jump on a certain frame instantly, 82 When you required to jump on a certain frame instantly,
83 you can change current keyframe by using this API. 83 you can change current position by using this API.
84 84
85 Warning: The range of keyframe is 0 ~ 1.]] 85 Warning: The range of progress is 0 ~ 1.]]
86 set { 86 set {
87 } 87 }
88 get { 88 get {
89 } 89 }
90 values { 90 values {
91 keyframe: double; [[Keyframe position. Value must be 0 ~ 1.]] 91 progress: double; [[Progress position. Value must be 0 ~ 1.]]
92 } 92 }
93 } 93 }
94 @property frame { 94 @property frame {
diff --git a/src/lib/elementary/efl_ui_animation_view_private.h b/src/lib/elementary/efl_ui_animation_view_private.h
index 183d076..2dec04d 100644
--- a/src/lib/elementary/efl_ui_animation_view_private.h
+++ b/src/lib/elementary/efl_ui_animation_view_private.h
@@ -14,7 +14,7 @@ struct _Efl_Ui_Animation_View_Data
14 Elm_Transit *transit; 14 Elm_Transit *transit;
15 Eina_Stringshare *file; 15 Eina_Stringshare *file;
16 double speed; 16 double speed;
17 double keyframe; 17 double progress;
18 double frame_cnt; 18 double frame_cnt;
19 int repeat_times; 19 int repeat_times;
20 double frame_duration; 20 double frame_duration;