1 #include <Elementary.h>
6 * @defgroup Transit Transit
9 * Transit is designed to set the various effects for the Evas_Object such like translation,
10 * rotation, etc. For using Effects, Create transit and insert the some of effects which are
11 * interested. Each effects has the type of Elm_Effect and those can be inserted into transit.
12 * Once effects are inserted into transit, transit will manage those effects.(ex) deleting).
17 Elm_Animator *animator;
18 Eina_List *effect_list;
19 Evas_Object *block_rect;
20 void (*completion_op) (void *data, Elm_Transit *transit);
22 Eina_Bool reserved_del:1;
27 void (*animation_op) (void *data, Elm_Animator *animator, double frame);
28 void (*begin_op) (void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt);
29 void (*end_op) (void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt);
30 void (*del_op) (void* data);
31 unsigned int shared_cnt;
35 static Evas_Object *_create_block_rect(Evas_Object *parent);
36 static void _transit_animate_cb(void *data, Elm_Animator *animator,
38 static void _transit_fx_begin(Elm_Transit *transit);
39 static void _transit_fx_end(Elm_Transit *transit);
40 static void _transit_complete_cb(void *data);
41 static void _transit_fx_del(Elm_Effect *effect);
42 //static void _transit_parent_del(void *data);
46 _animator_parent_del(void *data)
48 Elm_Transit *transit = data;
49 elm_transit_del(data);
54 _create_block_rect(Evas_Object *parent)
60 rect = evas_object_rectangle_add(evas_object_evas_get(parent));
61 evas_output_size_get(evas_object_evas_get(parent), &w, &h);
62 evas_object_resize(rect, w, h);
63 evas_object_color_set(rect, 0, 0, 0, 0);
68 _transit_animate_cb(void *data, Elm_Animator *animator, double frame)
74 Elm_Transit *transit = data;
76 EINA_LIST_FOREACH(transit->effect_list, elist, effect)
78 effect->animation_op(effect->user_data, animator, frame);
83 _transit_fx_begin(Elm_Transit *transit)
89 Eina_Bool auto_reverse;
91 unsigned int repeat_cnt;
93 auto_reverse = elm_animator_auto_reverse_get(transit->animator);
94 repeat_cnt = elm_animator_repeat_get(transit->animator);
96 EINA_LIST_FOREACH(transit->effect_list, elist, effect)
99 effect->begin_op(effect->user_data, auto_reverse, repeat_cnt);
104 _transit_fx_end(Elm_Transit *transit)
110 Eina_Bool auto_reverse;
112 unsigned int repeat_cnt;
114 auto_reverse = elm_animator_auto_reverse_get(transit->animator);
115 repeat_cnt = elm_animator_repeat_get(transit->animator);
117 EINA_LIST_FOREACH(transit->effect_list, elist, effect)
120 effect->end_op(effect->user_data, auto_reverse, repeat_cnt);
125 _transit_complete_cb(void *data)
127 Elm_Transit *transit = (Elm_Transit *) data;
129 evas_render(evas_object_evas_get(transit->parent));
131 _transit_fx_end(transit);
133 if (transit->block_rect)
134 evas_object_hide(transit->block_rect);
136 if (transit->completion_op)
137 transit->completion_op(transit->completion_arg, transit);
139 if (transit->reserved_del)
141 transit->reserved_del = EINA_FALSE;
142 elm_transit_del(transit);
147 _transit_fx_del(Elm_Effect *effect)
152 --effect->shared_cnt;
154 if (effect->shared_cnt > 0)
158 (*effect->del_op)(effect->user_data);
160 if (effect->user_data)
161 free(effect->user_data);
166 * Set the event blocked when transit is operating.
168 * @param[in] transit Transit object
169 * @param[in] disabled Disable or enable
174 elm_transit_event_block_disabled_set(Elm_Transit *transit, Eina_Bool disabled)
181 if (transit->block_rect)
183 evas_object_del(transit->block_rect);
184 transit->block_rect = NULL;
189 if (!transit->block_rect)
190 transit->block_rect = _create_block_rect(transit->parent);
195 * Get the value of event blockd status.
197 * @param[in] transit Transit
198 * @return EINA_TRUE, when event block is disabled
203 elm_transit_event_block_disabled_get(Elm_Transit *transit)
207 return transit->block_rect ? EINA_TRUE : EINA_FALSE;
211 * Remove effect from transit.
213 * @param[in] transit Transit
214 * @param[in] effect Effect to be removed
215 * @return EINA_TRUE, if the effect is removed
216 * @warning If removed effect does not inserted in any transit, it will be deleted.
221 elm_transit_fx_remove(Elm_Transit *transit, Elm_Effect *effect)
230 EINA_LIST_FOREACH(transit->effect_list, elist, _effect)
232 if (_effect == effect)
234 transit->effect_list =
235 eina_list_remove(transit->effect_list, _effect);
236 _transit_fx_del(_effect);
244 * Remove all current inserted effects.
246 * @param[in] transit Transit
251 elm_transit_fx_clear(Elm_Transit *transit)
260 EINA_LIST_FOREACH(transit->effect_list, elist, effect)
262 transit->effect_list = eina_list_remove(transit->effect_list, effect);
263 _transit_fx_del(effect);
268 * Get the list of current inseted effects.
270 * @param[in] transit Transit
271 * @return Effect list
275 EAPI const Eina_List *
276 elm_transit_fx_get(Elm_Transit *transit)
280 return transit->effect_list;
284 * Set the user-callback function when the transit operation is done.
286 * @param[in] transit Transit
287 * @param[in] op Callback function pointer
288 * @param[in] data Callback funtion user data
293 elm_transit_completion_callback_set(Elm_Transit *transit,
294 void (*op) (void *data,
295 Elm_Transit *transit),
300 transit->completion_op = op;
301 transit->completion_arg = data;
307 * @param[in] transit Transit to be deleted
312 elm_transit_del(Elm_Transit *transit)
316 if (elm_animator_operating_get(transit->animator))
318 transit->reserved_del = EINA_TRUE;
322 if (transit->block_rect)
323 evas_object_del(transit->block_rect);
325 elm_animator_del(transit->animator);
326 elm_transit_fx_clear(transit);
328 // if(transit->parent)
330 // evas_object_event_callback_del(transit->parent, EVAS_CALLBACK_DEL, _transit_parent_del);
337 * Set the transit animation acceleration style.
339 * @param transit Transit
340 * @param cs Curve style(Please refer elm_animator_curve_style_set)
345 elm_transit_curve_style_set(Elm_Transit *transit, Elm_Animator_Curve_Style cs)
349 elm_animator_curve_style_set(transit->animator, cs);
356 * @param[in] parent Parent object
362 elm_transit_add(Evas_Object *parent)
364 Elm_Transit *transit = calloc(1, sizeof(Elm_Transit));
369 transit->animator = elm_animator_add(parent);
371 if (!transit->animator)
377 transit->parent = parent;
378 elm_animator_operation_callback_set(transit->animator, _transit_animate_cb,
380 elm_animator_completion_callback_set(transit->animator, _transit_complete_cb,
382 elm_transit_event_block_disabled_set(transit, EINA_FALSE);
386 evas_object_event_callback_add(parent, EVAS_CALLBACK_DEL, _transit_parent_del,
394 * Set reverse effect automatically.
396 * @param[in] transit Transit
397 * @param[in] reverse EINA_TRUE is reverse.
402 elm_transit_auto_reverse_set(Elm_Transit *transit, Eina_Bool reverse)
406 elm_animator_auto_reverse_set(transit->animator, reverse);
410 * Insert an effect into the transit.
412 * @param[in] transit Transit
413 * @param[in] effect Effect to be inserted
414 * @return EINA_TRUE is success
419 elm_transit_fx_insert(Elm_Transit *transit, Elm_Effect *effect)
428 EINA_LIST_FOREACH(transit->effect_list, elist, _effect)
430 if (_effect == effect)
434 ++effect->shared_cnt;
435 transit->effect_list = eina_list_append(transit->effect_list, effect);
441 * Set the transit repeat count. Effect will be repeated by repeat count.
443 * @param[in] transit Transit
444 * @param[in] repeat Repeat count
449 elm_transit_repeat_set(Elm_Transit *transit, unsigned int repeat)
453 elm_animator_repeat_set(transit->animator, repeat);
457 * Stop the current transit, if the transit is operating.
459 * @param[in] transit Transit
464 elm_transit_stop(Elm_Transit *transit)
468 elm_animator_stop(transit->animator);
472 * Run the all the inserted effects.
474 * @param[in] transit Transit
475 * @param[in] duration Transit time in seconds
480 elm_transit_run(Elm_Transit *transit, double duration)
484 _transit_fx_begin(transit);
485 elm_animator_duration_set(transit->animator, duration);
488 if (transit->block_rect)
489 evas_object_show(transit->block_rect);
491 elm_animator_animate(transit->animator);
493 //If failed to animate.
494 if (!elm_animator_operating_get(transit->animator))
496 if (transit->block_rect)
497 evas_object_hide(transit->block_rect);
498 _transit_fx_end(transit);
505 * @param[in] transit Transit
510 elm_transit_pause(Elm_Transit *transit)
515 elm_animator_pause(transit->animator);
521 * @param[in] transit Transit
526 elm_transit_resume(Elm_Transit *transit)
531 elm_animator_resume(transit->animator);
536 /////////////////////////////////////////////////////////////////////////////////////
538 /////////////////////////////////////////////////////////////////////////////////////
539 typedef struct _resizing Elm_Fx_Resizing;
540 static void _elm_fx_resizing_op(void *data, Elm_Animator *animator,
542 static void _elm_fx_resizing_begin(void *data, Eina_Bool auto_reverse,
543 unsigned int repeat_cnt);
555 _elm_fx_resizing_begin(void *data, Eina_Bool auto_reverse,
556 unsigned int repeat_cnt)
558 Elm_Fx_Resizing *resizing = data;
560 evas_object_show(resizing->obj);
561 evas_object_resize(resizing->obj, resizing->from.w, resizing->from.h);
565 _elm_fx_resizing_op(void *data, Elm_Animator *animator, double frame)
569 Elm_Fx_Resizing *resizing = data;
571 w = resizing->from.w + (Evas_Coord) ((float)resizing->to.h * (float)frame);
572 h = resizing->from.h + (Evas_Coord) ((float)resizing->to.w * (float)frame);
573 evas_object_resize(resizing->obj, w, h);
577 * Add Resizing effect.
579 * @param[in] obj Evas_Object that effect is applying to
580 * @param[in] from_w Object width size when effect begins
581 * @param[in] from_h Object height size when effect begins
582 * @param[in] to_w Object width size when effect ends
583 * @param[in] to_h Object height size when effect ends
584 * @return Resizing effect
589 elm_fx_resizing_add(Evas_Object *obj, Evas_Coord from_w, Evas_Coord from_h,
590 Evas_Coord to_w, Evas_Coord to_h)
594 Elm_Fx_Resizing *resizing;
599 effect = calloc(1, sizeof(Elm_Effect));
603 resizing = calloc(1, sizeof(Elm_Fx_Resizing));
611 resizing->from.w = from_w;
612 resizing->from.h = from_h;
613 resizing->to.w = to_w - from_w;
614 resizing->to.h = to_h - from_h;
616 effect->begin_op = _elm_fx_resizing_begin;
617 effect->animation_op = _elm_fx_resizing_op;
618 effect->user_data = resizing;
623 /////////////////////////////////////////////////////////////////////////////////////
625 /////////////////////////////////////////////////////////////////////////////////////
626 typedef struct _translation Elm_Fx_Translation;
627 static void _elm_fx_translation_op(void *data, Elm_Animator *animator,
629 static void _elm_fx_translation_begin(void *data, Eina_Bool auto_reverse,
630 unsigned int repeat_cnt);
631 static void _elm_fx_translation_end(void *data, Eina_Bool auto_reverse,
632 unsigned int repeat_cnt);
644 _elm_fx_translation_begin(void *data, Eina_Bool auto_reverse,
645 unsigned int repeat_cnt)
647 Elm_Fx_Translation *translation = data;
649 evas_object_show(translation->obj);
650 evas_object_move(translation->obj, translation->from.x, translation->from.y);
654 _elm_fx_translation_end(void *data, Eina_Bool auto_reverse,
655 unsigned int repeat_cnt)
657 Elm_Fx_Translation *translation = data;
659 evas_object_move(translation->obj, translation->from.x + translation->to.x,
660 translation->from.y + translation->to.y);
664 _elm_fx_translation_op(void *data, Elm_Animator *animator, double frame)
668 Elm_Fx_Translation *translation = data;
670 x = translation->from.x +
671 (Evas_Coord) ((float)translation->to.x * (float)frame);
672 y = translation->from.y +
673 (Evas_Coord) ((float)translation->to.y * (float)frame);
674 evas_object_move(translation->obj, x, y);
678 * Add Translation effect.
680 * @param[in] obj Evas_Object that effect is applying to
681 * @param[in] from_x Position X when effect begins
682 * @param[in] from_y Position Y when effect begins
683 * @param[in] to_x Position X when effect ends
684 * @param[in] to_y Position Y when effect ends
685 * @return Translation effect
690 elm_fx_translation_add(Evas_Object *obj, Evas_Coord from_x, Evas_Coord from_y,
691 Evas_Coord to_x, Evas_Coord to_y)
695 Elm_Fx_Translation *translation;
700 effect = calloc(1, sizeof(Elm_Effect));
704 translation = calloc(1, sizeof(Elm_Fx_Translation));
712 translation->obj = obj;
713 translation->from.x = from_x;
714 translation->from.y = from_y;
715 translation->to.x = to_x - from_x;
716 translation->to.y = to_y - from_y;
718 effect->begin_op = _elm_fx_translation_begin;
719 effect->end_op = _elm_fx_translation_end;
720 effect->animation_op = _elm_fx_translation_op;
721 effect->user_data = translation;
726 /////////////////////////////////////////////////////////////////////////////////////
728 /////////////////////////////////////////////////////////////////////////////////////
729 typedef struct _zoom Elm_Fx_Zoom;
730 static void _elm_fx_zoom_op(void *data, Elm_Animator * animator,
732 static void _elm_fx_zoom_begin(void *data, Eina_Bool reverse,
733 unsigned int repeat);
734 static void _elm_fx_zoom_end(void *data, Eina_Bool reverse,
735 unsigned int repeat);
744 _elm_fx_zoom_begin(void *data, Eina_Bool reverse, unsigned int repeat)
746 Elm_Fx_Zoom *zoom = data;
748 evas_object_show(zoom->obj);
749 _elm_fx_zoom_op(data, NULL, 0);
753 _elm_fx_zoom_end(void *data, Eina_Bool reverse, unsigned int repeat)
755 Elm_Fx_Zoom *zoom = data;
757 evas_object_map_enable_set(zoom->obj, EINA_FALSE);
761 _elm_fx_zoom_op(void *data, Elm_Animator *animator, double frame)
767 Evas_Coord x, y, w, h;
769 map = evas_map_new(4);
774 evas_object_geometry_get(zoom->obj, &x, &y, &w, &h);
775 evas_map_smooth_set(map, EINA_TRUE);
776 evas_map_util_points_populate_from_object_full(map, zoom->obj,
779 evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, 10000);
780 evas_object_map_set(zoom->obj, map);
781 evas_object_map_enable_set(zoom->obj, EINA_TRUE);
788 * @param[in] obj Evas_Object that effect is applying to
789 * @param[in] from_rate Scale rate when effect begins (1 is current rate)
790 * @param[in] to_rate Scale rate when effect ends
791 * @return Zoom effect
796 elm_fx_zoom_add(Evas_Object *obj, float from_rate, float to_rate)
805 effect = calloc(1, sizeof(Elm_Effect));
809 zoom = calloc(1, sizeof(Elm_Fx_Zoom));
817 zoom->from = (10000 - (from_rate * 10000)) * (1 / from_rate);
818 zoom->to = ((10000 - (to_rate * 10000)) * (1 / to_rate)) - zoom->from;
819 effect->begin_op = _elm_fx_zoom_begin;
820 effect->end_op = _elm_fx_zoom_end;
821 effect->animation_op = _elm_fx_zoom_op;
822 effect->user_data = zoom;
828 /////////////////////////////////////////////////////////////////////////////////////
830 /////////////////////////////////////////////////////////////////////////////////////
831 typedef struct _flip Elm_Fx_Flip;
832 static void _elm_fx_flip_op(void *data, Elm_Animator *animator,
834 static void _elm_fx_flip_end(void *data, Eina_Bool auto_reverse,
835 unsigned int repeat_cnt);
841 Elm_Fx_Flip_Axis axis;
846 _elm_fx_flip_end(void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt)
848 Elm_Fx_Flip *flip = data;
850 evas_object_map_enable_set(flip->front, EINA_FALSE);
851 evas_object_map_enable_set(flip->back, EINA_FALSE);
855 _elm_fx_flip_op(void *data, Elm_Animator *animator, double frame)
865 Evas_Coord x, y, w, h;
867 map = evas_map_new(4);
874 degree = (float)(frame * 180);
876 degree = (float)(frame * -180);
878 if (degree < 90 && degree > -90)
881 if(flip->back != flip->front) {
882 evas_object_hide(flip->back);
883 evas_object_show(flip->front);
889 if(flip->back != flip->front) {
890 evas_object_hide(flip->front);
891 evas_object_show(flip->back);
895 evas_map_smooth_set(map, EINA_TRUE);
896 evas_map_util_points_populate_from_object_full(map, obj, 0);
897 evas_object_geometry_get(obj, &x, &y, &w, &h);
898 Evas_Coord half_w = (w / 2);
900 Evas_Coord half_h = (h / 2);
902 if (flip->axis == ELM_FX_FLIP_AXIS_Y)
904 if ((degree >= 90) || (degree <= -90))
906 evas_map_point_image_uv_set(map, 0, w, 0);
907 evas_map_point_image_uv_set(map, 1, 0, 0);
908 evas_map_point_image_uv_set(map, 2, 0, h);
909 evas_map_point_image_uv_set(map, 3, w, h);
911 evas_map_util_3d_rotate(map, 0, degree, 0, x + half_w, y + half_h, 0);
915 if ((degree >= 90) || (degree <= -90))
917 evas_map_point_image_uv_set(map, 0, 0, h);
918 evas_map_point_image_uv_set(map, 1, w, h);
919 evas_map_point_image_uv_set(map, 2, w, 0);
920 evas_map_point_image_uv_set(map, 3, 0, 0);
922 evas_map_util_3d_rotate(map, degree, 0, 0, x + half_w, y + half_h, 0);
924 evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, 10000);
925 evas_object_map_enable_set(flip->front, EINA_TRUE);
926 evas_object_map_enable_set(flip->back, EINA_TRUE);
927 evas_object_map_set(obj, map);
934 * @param[in] front Front surface object
935 * @param[in] back Back surface object
936 * @param[in] axis Flipping Axis(X or Y)
937 * @param[in] cw Flipping Direction. EINA_TRUE is clock-wise
938 * @return Flip effect
943 elm_fx_flip_add(Evas_Object *front, Evas_Object *back, Elm_Fx_Flip_Axis axis,
950 if ((!front) || (!back))
953 effect = calloc(1, sizeof(Elm_Effect));
957 flip = calloc(1, sizeof(Elm_Fx_Flip));
969 effect->end_op = _elm_fx_flip_end;
970 effect->animation_op = _elm_fx_flip_op;
971 effect->user_data = flip;
976 /////////////////////////////////////////////////////////////////////////////////////
978 /////////////////////////////////////////////////////////////////////////////////////
979 typedef struct _resizable_flip Elm_Fx_ResizableFlip;
980 static void _elm_fx_resizable_flip_begin(void *data, Eina_Bool reverse,
981 unsigned int repeat);
982 static void _elm_fx_resizable_flip_end(void *data, Eina_Bool auto_reverse,
983 unsigned int repeat_cnt);
984 static void _elm_fx_resizable_flip_op(void *data, Elm_Animator *animator,
986 static void _set_image_uv_by_axis_y(Evas_Map *map, Elm_Fx_ResizableFlip *flip,
988 static void _set_image_uv_by_axis_x(Evas_Map *map, Elm_Fx_ResizableFlip *flip,
991 struct _resizable_flip
995 Elm_Fx_Flip_Axis axis;
999 } from_pos, from_size, to_pos, to_size;
1004 _elm_fx_resizable_flip_begin(void *data, Eina_Bool reverse, unsigned int repeat)
1006 Elm_Fx_ResizableFlip *resizable_flip = data;
1008 evas_object_show(resizable_flip->front);
1009 _elm_fx_resizable_flip_op(data, NULL, 0);
1013 _elm_fx_resizable_flip_end(void *data, Eina_Bool auto_reverse,
1014 unsigned int repeat_cnt)
1016 Elm_Fx_ResizableFlip *resizable_flip = data;
1018 evas_object_map_enable_set(resizable_flip->front, EINA_FALSE);
1019 evas_object_map_enable_set(resizable_flip->back, EINA_FALSE);
1023 _set_image_uv_by_axis_y(Evas_Map *map, Elm_Fx_ResizableFlip *flip,
1026 if ((degree >= 90) || (degree <= -90))
1028 evas_map_point_image_uv_set(map, 0,
1029 (flip->from_size.x * 2) + flip->to_size.x,
1031 evas_map_point_image_uv_set(map, 1, 0, 0);
1032 evas_map_point_image_uv_set(map, 2, 0,
1033 (flip->from_size.y * 2) + flip->to_size.y);
1034 evas_map_point_image_uv_set(map, 3,
1035 (flip->from_size.x * 2) + flip->to_size.x,
1036 (flip->from_size.y * 2) + flip->to_size.y);
1040 evas_map_point_image_uv_set(map, 0, 0, 0);
1041 evas_map_point_image_uv_set(map, 1, flip->from_size.x, 0);
1042 evas_map_point_image_uv_set(map, 2, flip->from_size.x,
1044 evas_map_point_image_uv_set(map, 3, 0, flip->from_size.y);
1049 _set_image_uv_by_axis_x(Evas_Map *map, Elm_Fx_ResizableFlip *flip,
1052 if ((degree >= 90) || (degree <= -90))
1054 evas_map_point_image_uv_set(map, 0, 0,
1055 (flip->from_size.y * 2) + flip->to_size.y);
1056 evas_map_point_image_uv_set(map, 1,
1057 (flip->from_size.x * 2) + flip->to_size.x,
1058 (flip->from_size.y * 2) + flip->to_size.y);
1059 evas_map_point_image_uv_set(map, 2,
1060 (flip->from_size.x * 2) + flip->to_size.x,
1062 evas_map_point_image_uv_set(map, 3, 0, 0);
1066 evas_map_point_image_uv_set(map, 0, 0, 0);
1067 evas_map_point_image_uv_set(map, 1, flip->from_size.x, 0);
1068 evas_map_point_image_uv_set(map, 2, flip->from_size.x,
1070 evas_map_point_image_uv_set(map, 3, 0, flip->to_size.y);
1075 _elm_fx_resizable_flip_op(void *data, Elm_Animator *animator, double frame)
1077 Elm_Fx_ResizableFlip *resizable_flip;
1087 Evas_Coord half_w, half_h;
1089 map = evas_map_new(4);
1093 resizable_flip = data;
1095 if (resizable_flip->cw)
1096 degree = (float)(frame * 180);
1098 degree = (float)(frame * -180);
1100 if ((degree < 90) && (degree > -90))
1102 obj = resizable_flip->front;
1103 if(resizable_flip->back != resizable_flip->front) {
1104 evas_object_hide(resizable_flip->back);
1105 evas_object_show(resizable_flip->front);
1110 obj = resizable_flip->back;
1111 if(resizable_flip->back != resizable_flip->front) {
1112 evas_object_hide(resizable_flip->front);
1113 evas_object_show(resizable_flip->back);
1116 evas_map_smooth_set(map, EINA_TRUE);
1118 x = resizable_flip->from_pos.x + (resizable_flip->to_pos.x * frame);
1119 y = resizable_flip->from_pos.y + (resizable_flip->to_pos.y * frame);
1120 w = resizable_flip->from_size.x + (resizable_flip->to_size.x * frame);
1121 h = resizable_flip->from_size.y + (resizable_flip->to_size.y * frame);
1122 evas_map_point_coord_set(map, 0, x, y, 0);
1123 evas_map_point_coord_set(map, 1, x + w, y, 0);
1124 evas_map_point_coord_set(map, 2, x + w, y + h, 0);
1125 evas_map_point_coord_set(map, 3, x, y + h, 0);
1127 half_w = (Evas_Coord) (w / 2);
1128 half_h = (Evas_Coord) (h / 2);
1130 if (resizable_flip->axis == ELM_FX_FLIP_AXIS_Y)
1132 _set_image_uv_by_axis_y(map, resizable_flip, degree);
1133 evas_map_util_3d_rotate(map, 0, degree, 0, x + half_w, y + half_h, 0);
1137 _set_image_uv_by_axis_x(map, resizable_flip, degree);
1138 evas_map_util_3d_rotate(map, degree, 0, 0, x + half_w, y + half_h, 0);
1141 evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, 10000);
1142 evas_object_map_enable_set(resizable_flip->front, EINA_TRUE);
1143 evas_object_map_enable_set(resizable_flip->back, EINA_TRUE);
1144 evas_object_map_set(obj, map);
1149 * Add ResizbleFlip effect. the size of each surface objects are interpolated automatically.
1151 * @param[in] front Front surface object
1152 * @param[in] back Back surface object
1153 * @param[in] axis Flipping Axis.(X or Y)
1154 * @param[in] cw Flipping Direction. EINA_TRUE is clock-wise
1155 * @return Flip effect
1160 elm_fx_resizable_flip_add(Evas_Object *front, Evas_Object *back,
1161 Elm_Fx_Flip_Axis axis, Eina_Bool cw)
1163 Elm_Fx_ResizableFlip *resizable_flip;
1167 Evas_Coord front_x, front_y, front_w, front_h;
1169 Evas_Coord back_x, back_y, back_w, back_h;
1171 if (!front || !back)
1174 effect = calloc(1, sizeof(Elm_Effect));
1178 resizable_flip = calloc(1, sizeof(Elm_Fx_ResizableFlip));
1180 if (!resizable_flip)
1186 resizable_flip->front = front;
1187 resizable_flip->back = back;
1188 resizable_flip->cw = cw;
1189 resizable_flip->axis = axis;
1191 evas_object_geometry_get(resizable_flip->front, &front_x, &front_y, &front_w,
1193 evas_object_geometry_get(resizable_flip->back, &back_x, &back_y, &back_w,
1196 resizable_flip->from_pos.x = front_x;
1197 resizable_flip->from_pos.y = front_y;
1198 resizable_flip->to_pos.x = back_x - front_x;
1199 resizable_flip->to_pos.y = back_y - front_y;
1201 resizable_flip->from_size.x = front_w;
1202 resizable_flip->from_size.y = front_h;
1203 resizable_flip->to_size.x = back_w - front_w;
1204 resizable_flip->to_size.y = back_h - front_h;
1206 effect->begin_op = _elm_fx_resizable_flip_begin;
1207 effect->end_op = _elm_fx_resizable_flip_end;
1208 effect->animation_op = _elm_fx_resizable_flip_op;
1209 effect->user_data = resizable_flip;
1214 /////////////////////////////////////////////////////////////////////////////////////
1216 /////////////////////////////////////////////////////////////////////////////////////
1217 typedef struct _wipe Elm_Fx_Wipe;
1218 static void _elm_fx_wipe_op(void *data, Elm_Animator *animator,
1220 static void _elm_fx_wipe_begin(void *data, Eina_Bool auto_repeat,
1221 unsigned int repeat_cnt);
1222 static void _elm_fx_wipe_end(void *data, Eina_Bool auto_repeat,
1223 unsigned int repeat_cnt);
1224 static void _elm_fx_wipe_hide(Evas_Map * map, Elm_Fx_Wipe_Dir dir,
1225 float x, float y, float w, float h, float frame);
1226 static void _elm_fx_wipe_show(Evas_Map *map, Elm_Fx_Wipe_Dir dir,
1227 float x, float y, float w, float h, float frame);
1232 Elm_Fx_Wipe_Type type;
1233 Elm_Fx_Wipe_Dir dir;
1237 _elm_fx_wipe_begin(void *data, Eina_Bool auto_repeat, unsigned int repeat_cnt)
1239 Elm_Fx_Wipe *wipe = data;
1241 evas_object_show(wipe->obj);
1242 _elm_fx_wipe_op(data, NULL, 0);
1246 _elm_fx_wipe_end(void *data, Eina_Bool auto_repeat, unsigned int repeat_cnt)
1248 Elm_Fx_Wipe *wipe = data;
1250 evas_object_map_enable_set(wipe->obj, EINA_FALSE);
1254 _elm_fx_wipe_hide(Evas_Map * map, Elm_Fx_Wipe_Dir dir, float x, float y,
1255 float w, float h, float frame)
1261 case ELM_FX_WIPE_DIR_UP:
1264 evas_map_point_image_uv_set(map, 0, 0, 0);
1265 evas_map_point_image_uv_set(map, 1, w, 0);
1266 evas_map_point_image_uv_set(map, 2, w, h2);
1267 evas_map_point_image_uv_set(map, 3, 0, h2);
1268 evas_map_point_coord_set(map, 0, x, y, 0);
1269 evas_map_point_coord_set(map, 1, w2, y, 0);
1270 evas_map_point_coord_set(map, 2, w2, y+h2, 0);
1271 evas_map_point_coord_set(map, 3, x, y+h2, 0);
1273 case ELM_FX_WIPE_DIR_LEFT:
1274 w2 = w - (w * frame);
1276 evas_map_point_image_uv_set(map, 0, 0, 0);
1277 evas_map_point_image_uv_set(map, 1, w2, 0);
1278 evas_map_point_image_uv_set(map, 2, w2, h);
1279 evas_map_point_image_uv_set(map, 3, 0, h);
1280 evas_map_point_coord_set(map, 0, x, y, 0);
1281 evas_map_point_coord_set(map, 1, x + w2, y, 0);
1282 evas_map_point_coord_set(map, 2, x + w2, h2, 0);
1283 evas_map_point_coord_set(map, 3, x, h2, 0);
1285 case ELM_FX_WIPE_DIR_RIGHT:
1288 evas_map_point_image_uv_set(map, 0, w2, 0);
1289 evas_map_point_image_uv_set(map, 1, w, 0);
1290 evas_map_point_image_uv_set(map, 2, w, h);
1291 evas_map_point_image_uv_set(map, 3, w2, h);
1292 evas_map_point_coord_set(map, 0, x + w2, y, 0);
1293 evas_map_point_coord_set(map, 1, x + w, y, 0);
1294 evas_map_point_coord_set(map, 2, x + w, h2, 0);
1295 evas_map_point_coord_set(map, 3, x + w2, h2, 0);
1297 case ELM_FX_WIPE_DIR_DOWN:
1300 evas_map_point_image_uv_set(map, 0, 0, h2);
1301 evas_map_point_image_uv_set(map, 1, w, h2);
1302 evas_map_point_image_uv_set(map, 2, w, h);
1303 evas_map_point_image_uv_set(map, 3, 0, h);
1304 evas_map_point_coord_set(map, 0, x, y + h2, 0);
1305 evas_map_point_coord_set(map, 1, w2, y + h2, 0);
1306 evas_map_point_coord_set(map, 2, w2, y + h, 0);
1307 evas_map_point_coord_set(map, 3, x, y + h, 0);
1313 evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, 10000);
1317 _elm_fx_wipe_show(Evas_Map *map, Elm_Fx_Wipe_Dir dir, float x, float y,
1318 float w, float h, float frame)
1324 case ELM_FX_WIPE_DIR_UP:
1326 h2 = (h - (h * frame));
1327 evas_map_point_image_uv_set(map, 0, 0, h2);
1328 evas_map_point_image_uv_set(map, 1, w, h2);
1329 evas_map_point_image_uv_set(map, 2, w, h);
1330 evas_map_point_image_uv_set(map, 3, 0, h);
1331 evas_map_point_coord_set(map, 0, x, y + h2, 0);
1332 evas_map_point_coord_set(map, 1, w2, y + h2, 0);
1333 evas_map_point_coord_set(map, 2, w2, y + h, 0);
1334 evas_map_point_coord_set(map, 3, x, y + h, 0);
1336 case ELM_FX_WIPE_DIR_LEFT:
1337 w2 = (w - (w * frame));
1339 evas_map_point_image_uv_set(map, 0, w2, 0);
1340 evas_map_point_image_uv_set(map, 1, w, 0);
1341 evas_map_point_image_uv_set(map, 2, w, h);
1342 evas_map_point_image_uv_set(map, 3, w2, h);
1343 evas_map_point_coord_set(map, 0, x + w2, y, 0);
1344 evas_map_point_coord_set(map, 1, x + w, y, 0);
1345 evas_map_point_coord_set(map, 2, x +w, h2, 0);
1346 evas_map_point_coord_set(map, 3, x + w2, h2, 0);
1348 case ELM_FX_WIPE_DIR_RIGHT:
1351 evas_map_point_image_uv_set(map, 0, 0, 0);
1352 evas_map_point_image_uv_set(map, 1, w2, 0);
1353 evas_map_point_image_uv_set(map, 2, w2, h);
1354 evas_map_point_image_uv_set(map, 3, 0, h);
1355 evas_map_point_coord_set(map, 0, x, y, 0);
1356 evas_map_point_coord_set(map, 1, x + w2, y, 0);
1357 evas_map_point_coord_set(map, 2, x + w2, h2, 0);
1358 evas_map_point_coord_set(map, 3, x, h2, 0);
1360 case ELM_FX_WIPE_DIR_DOWN:
1363 evas_map_point_image_uv_set(map, 0, 0, 0);
1364 evas_map_point_image_uv_set(map, 1, w, 0);
1365 evas_map_point_image_uv_set(map, 2, w, h2);
1366 evas_map_point_image_uv_set(map, 3, 0, h2);
1367 evas_map_point_coord_set(map, 0, x, y, 0);
1368 evas_map_point_coord_set(map, 1, w2, y, 0);
1369 evas_map_point_coord_set(map, 2, w2, y + h2, 0);
1370 evas_map_point_coord_set(map, 3, x, y + h2, 0);
1376 evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, 10000);
1380 _elm_fx_wipe_op(void *data, Elm_Animator *animator, double frame)
1386 Evas_Coord _x, _y, _w, _h;
1388 map = evas_map_new(4);
1393 evas_map_smooth_set(map, EINA_TRUE);
1394 evas_object_geometry_get(wipe->obj, &_x, &_y, &_w, &_h);
1396 if (wipe->type == ELM_FX_WIPE_TYPE_SHOW)
1397 _elm_fx_wipe_show(map, wipe->dir, _x, _y, _w, _h, (float)frame);
1399 _elm_fx_wipe_hide(map, wipe->dir, _x, _y, _w, _h, (float)frame);
1401 evas_object_map_enable_set(wipe->obj, EINA_TRUE);
1402 evas_object_map_set(wipe->obj, map);
1409 * @param[in] obj Evas_Object that effect is applying to
1410 * @param[in] type Wipe type. Hide or show
1411 * @param[in] dir Wipe Direction
1412 * @return Wipe effect
1417 elm_fx_wipe_add(Evas_Object *obj, Elm_Fx_Wipe_Type type, Elm_Fx_Wipe_Dir dir)
1426 effect = calloc(1, sizeof(Elm_Effect));
1430 wipe = calloc(1, sizeof(Elm_Fx_Wipe));
1440 effect->begin_op = _elm_fx_wipe_begin;
1441 effect->end_op = _elm_fx_wipe_end;
1442 effect->animation_op = _elm_fx_wipe_op;
1443 effect->user_data = wipe;
1448 /////////////////////////////////////////////////////////////////////////////////////
1450 /////////////////////////////////////////////////////////////////////////////////////
1451 typedef struct _color Elm_Fx_Color;
1452 static void _elm_fx_color_begin(void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt);
1453 static void _elm_fx_color_op(void *data, Elm_Animator *animator, double frame);
1458 struct _unsigned_color
1460 unsigned int r, g, b, a;
1462 struct _signed_color
1469 _elm_fx_color_begin(void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt)
1471 Elm_Fx_Color *color = data;
1473 evas_object_show(color->obj);
1477 _elm_fx_color_op(void *data, Elm_Animator *animator, double frame)
1479 Elm_Fx_Color *color;
1481 unsigned int r, g, b, a;
1484 r = (color->from.r + (int)((float)color->to.r * frame));
1485 g = (color->from.g + (int)((float)color->to.g * frame));
1486 b = (color->from.b + (int)((float)color->to.b * frame));
1487 a = (color->from.a + (int)((float)color->to.a * frame));
1489 evas_object_color_set(color->obj, r, g, b, a);
1495 * @param[in] obj Evas_Object that effect is applying to
1496 * @param[in] from_r RGB R when effect begins
1497 * @param[in] from_g RGB G when effect begins
1498 * @param[in] from_b RGB B when effect begins
1499 * @param[in] from_a RGB A when effect begins
1500 * @param[in] to_r RGB R when effect ends
1501 * @param[in] to_g RGB G when effect ends
1502 * @param[in] to_b RGB B when effect ends
1503 * @param[in] to_a RGB A when effect ends
1504 * @return Color Effect
1509 elm_fx_color_add(Evas_Object *obj, unsigned int from_r, unsigned int from_g,
1510 unsigned int from_b, unsigned int from_a, unsigned int to_r,
1511 unsigned int to_g, unsigned int to_b, unsigned int to_a)
1515 Elm_Fx_Color *color;
1520 effect = calloc(1, sizeof(Elm_Effect));
1524 color = calloc(1, sizeof(Elm_Fx_Color));
1532 color->from.r = from_r;
1533 color->from.g = from_g;
1534 color->from.b = from_b;
1535 color->from.a = from_a;
1536 color->to.r = to_r - from_r;
1537 color->to.g = to_g - from_g;
1538 color->to.b = to_b - from_b;
1539 color->to.a = to_a - from_a;
1541 effect->begin_op = _elm_fx_color_begin;
1542 effect->animation_op = _elm_fx_color_op;
1543 effect->user_data = color;
1548 /////////////////////////////////////////////////////////////////////////////////////
1550 /////////////////////////////////////////////////////////////////////////////////////
1551 typedef struct _fade Elm_Fx_Fade;
1552 static void _elm_fx_fade_begin(void *data, Eina_Bool auto_reverse,
1553 unsigned int repeat_cnt);
1554 static void _elm_fx_fade_end(void *data, Eina_Bool auto_reverse,
1555 unsigned int repeat_cnt);
1556 static void _elm_fx_fade_op(void *data, Elm_Animator *animator,
1561 Evas_Object *before;
1563 struct _signed_color before_color, after_color;
1566 Eina_Bool inversed:1;
1570 _elm_fx_fade_begin(void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt)
1572 Elm_Fx_Fade *fade = data;
1574 fade->inversed = EINA_FALSE;
1578 _elm_fx_fade_end(void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt)
1580 Elm_Fx_Fade *fade = data;
1582 evas_object_color_set(fade->before, fade->before_color.r,
1583 fade->before_color.g, fade->before_color.b,
1584 fade->before_color.a);
1585 evas_object_color_set(fade->after, fade->after_color.r, fade->after_color.g,
1586 fade->after_color.b, fade->after_color.a);
1590 _elm_fx_fade_op(void *data, Elm_Animator *animator, double frame)
1600 if (!fade->inversed)
1602 evas_object_hide(fade->after);
1603 evas_object_show(fade->before);
1604 fade->inversed = EINA_TRUE;
1607 _frame = (1 - (frame * 2));
1609 evas_object_color_set(fade->before, fade->before_color.r * _frame,
1610 fade->before_color.g * _frame,
1611 fade->before_color.b * _frame,
1612 fade->before_color.a + fade->before_alpha * (1 -
1619 evas_object_hide(fade->before);
1620 evas_object_show(fade->after);
1621 fade->inversed = EINA_FALSE;
1624 _frame = ((frame - 0.5) * 2);
1626 evas_object_color_set(fade->after, fade->after_color.r * _frame,
1627 fade->after_color.g * _frame,
1628 fade->after_color.b * _frame,
1629 fade->after_color.a + fade->after_alpha * (1 -
1638 * @param[in] before Evas Object before fade in
1639 * @param[in] after Evas Object after fade out
1640 * @return Fade effect
1645 elm_fx_fade_add(Evas_Object *before, Evas_Object *after)
1651 if ((!before) && (!after))
1654 effect = calloc(1, sizeof(Elm_Effect));
1658 fade = calloc(1, sizeof(Elm_Fx_Fade));
1666 evas_object_color_get(before, &fade->before_color.r, &fade->before_color.g,
1667 &fade->before_color.b, &fade->before_color.a);
1668 evas_object_color_get(after, &fade->after_color.r, &fade->after_color.g,
1669 &fade->after_color.b, &fade->after_color.a);
1671 fade->before = before;
1672 fade->after = after;
1673 fade->before_alpha = (255 - fade->before_color.a);
1674 fade->after_alpha = (255 - fade->after_color.a);
1676 effect->begin_op = _elm_fx_fade_begin;
1677 effect->end_op = _elm_fx_fade_end;
1678 effect->animation_op = _elm_fx_fade_op;
1679 effect->user_data = fade;
1684 /////////////////////////////////////////////////////////////////////////////////////
1686 /////////////////////////////////////////////////////////////////////////////////////
1687 typedef struct _blend Elm_Fx_Blend;
1688 static void _elm_fx_blend_begin(void *data, Eina_Bool auto_reverse,
1689 unsigned int repeat_cnt);
1690 static void _elm_fx_blend_end(void *data, Eina_Bool auto_reverse,
1691 unsigned int repeat_cnt);
1692 static void _elm_fx_blend_op(void *data, Elm_Animator *animator,
1697 Evas_Object *before;
1699 struct _signed_color from, to;
1703 _elm_fx_blend_begin(void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt)
1705 Elm_Fx_Blend *blend = data;
1707 evas_object_show(blend->before);
1711 _elm_fx_blend_end(void *data, Eina_Bool auto_reverse, unsigned int repeat_cnt)
1713 Elm_Fx_Blend *blend = data;
1715 evas_object_color_set(blend->before, blend->from.r, blend->from.g,
1716 blend->from.b, blend->from.a);
1717 evas_object_color_set(blend->after, blend->to.r, blend->to.g, blend->to.b,
1720 evas_object_hide(blend->before);
1722 evas_object_hide(blend->after);
1726 _elm_fx_blend_op(void *data, Elm_Animator *animator, double frame)
1728 Elm_Fx_Blend *blend = data;
1730 evas_object_show(blend->after);
1731 evas_object_color_set(blend->before, (int)(blend->from.r * (1 - frame)),
1732 (int)(blend->from.g * (1 - frame)),
1733 (int)(blend->from.b * (1 - frame)),
1734 (int)(blend->from.a * (1 - frame)));
1735 evas_object_color_set(blend->after, (int)(blend->to.r * frame),
1736 (int)(blend->to.g * frame), (int)(blend->to.b * frame),
1737 (int)(blend->to.a * frame));
1743 * @param[in] before Evas Object before blending
1744 * @param[in] after Evas Object after blending
1745 * @return Blend effect
1750 elm_fx_blend_add(Evas_Object *before, Evas_Object *after)
1754 Elm_Fx_Blend *blend;
1756 if ((!before) && (!after))
1759 effect = calloc(1, sizeof(Elm_Effect));
1763 blend = calloc(1, sizeof(Elm_Fx_Blend));
1770 blend->before = before;
1771 blend->after = after;
1772 evas_object_color_get(before, &blend->from.r, &blend->from.g, &blend->from.b,
1774 evas_object_color_get(after, &blend->to.r, &blend->to.g, &blend->to.b,
1777 effect->begin_op = _elm_fx_blend_begin;
1778 effect->end_op = _elm_fx_blend_end;
1779 effect->animation_op = _elm_fx_blend_op;
1780 effect->user_data = blend;
1785 /////////////////////////////////////////////////////////////////////////////////////
1787 /////////////////////////////////////////////////////////////////////////////////////
1788 typedef struct _rotation Elm_Fx_Rotation;
1789 static void _elm_fx_rotation_begin(void *data, Eina_Bool auto_reverse,
1790 unsigned int repeat_cnt);
1791 static void _elm_fx_rotation_end(void *data, Eina_Bool auto_reverse,
1792 unsigned int repeat_cnt);
1793 static void _elm_fx_rotation_op(void *data, Elm_Animator *animator,
1804 _elm_fx_rotation_begin(void *data, Eina_Bool auto_reverse,
1805 unsigned int repeat_cnt)
1807 Elm_Fx_Rotation *rotation = data;
1809 evas_object_show(rotation->obj);
1813 _elm_fx_rotation_end(void *data, Eina_Bool auto_reverse,
1814 unsigned int repeat_cnt)
1816 Elm_Fx_Rotation *rotation = data;
1818 evas_object_map_enable_set(rotation->obj, EINA_FALSE);
1822 _elm_fx_rotation_op(void *data, Elm_Animator *animator, double frame)
1824 Elm_Fx_Rotation *rotation;
1828 Evas_Coord x, y, w, h;
1832 float half_w, half_h;
1834 map = evas_map_new(4);
1840 evas_map_smooth_set(map, EINA_TRUE);
1841 evas_map_util_points_populate_from_object_full(map, rotation->obj, 0);
1842 degree = rotation->from + (float)(frame * rotation->to);
1847 evas_object_geometry_get(rotation->obj, &x, &y, &w, &h);
1849 half_w = (float)w *0.5;
1851 half_h = (float)h *0.5;
1853 evas_map_util_3d_rotate(map, 0, 0, degree, x + half_w, y + half_h, 0);
1854 evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, 10000);
1855 evas_object_map_enable_set(rotation->obj, EINA_TRUE);
1856 evas_object_map_set(rotation->obj, map);
1861 * Add Rotation effect
1863 * @param[in] obj Evas_Object that effect is applying to
1864 * @param[in] from degree Degree when effect begins
1865 * @param[in] to_degree Degree when effect is ends
1866 * @param[in] cw Rotation direction. EINA_TRUE is clock wise
1867 * @return Rotation effect
1872 elm_fx_rotation_add(Evas_Object *obj, float from_degree, float to_degree,
1877 Elm_Fx_Rotation *rotation;
1882 effect = calloc(1, sizeof(Elm_Effect));
1886 rotation = calloc(1, sizeof(Elm_Fx_Rotation));
1894 rotation->obj = obj;
1895 rotation->from = from_degree;
1896 rotation->to = to_degree - from_degree;
1899 effect->begin_op = _elm_fx_rotation_begin;
1900 effect->end_op = _elm_fx_rotation_end;
1901 effect->animation_op = _elm_fx_rotation_op;
1902 effect->user_data = rotation;
1910 /////////////////////////////////////////////////////////////////////////////////////
1912 /////////////////////////////////////////////////////////////////////////////////////
1913 typedef struct _rotation3d Elm_Fx_Rotation3d;
1914 static void _elm_fx_rotation3d_begin(void *data, Eina_Bool auto_reverse,
1915 unsigned int repeat_cnt);
1916 static void _elm_fx_rotation3d_end(void *data, Eina_Bool auto_reverse,
1917 unsigned int repeat_cnt);
1918 static void _elm_fx_rotation3d_op(void *data, Elm_Animator *animator,
1930 _elm_fx_rotation3d_begin(void *data, Eina_Bool auto_reverse,
1931 unsigned int repeat_cnt)
1933 Elm_Fx_Rotation3d *rotation = data;
1934 evas_object_show(rotation->obj);
1938 _elm_fx_rotation3d_end(void *data, Eina_Bool auto_reverse,
1939 unsigned int repeat_cnt)
1941 Elm_Fx_Rotation3d *rotation = data;
1942 evas_object_map_enable_set(rotation->obj, EINA_FALSE);
1946 _elm_fx_rotation3d_op(void *data, Elm_Animator *animator, double frame)
1948 Elm_Fx_Rotation3d *rotation;
1952 Evas_Coord x, y, w, h;
1956 float half_w, half_h;
1958 map = evas_map_new(4);
1964 evas_map_smooth_set(map, EINA_TRUE);
1965 evas_map_util_points_populate_from_object_full(map, rotation->obj, 0);
1966 degree[0] = rotation->from[0] + (float)(frame * rotation->to[0]);
1967 degree[1] = rotation->from[1] + (float)(frame * rotation->to[1]);
1968 degree[2] = rotation->from[2] + (float)(frame * rotation->to[2]);
1970 evas_object_geometry_get(rotation->obj, &x, &y, &w, &h);
1972 half_w = (float)w *0.5;
1974 half_h = (float)h *0.5;
1976 evas_map_util_3d_rotate(map, degree[0], degree[1], degree[2], rotation->axis_pos[0], rotation->axis_pos[1], rotation->axis_pos[2]);
1977 evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, 1000);
1978 evas_object_map_enable_set(rotation->obj, EINA_TRUE);
1979 evas_object_map_set(rotation->obj, map);
1984 * Add Rotation3d effect
1986 * @param[in] obj Evas_Object that effect is applying to
1987 * @param[in] from degree Degree when effect begins
1988 * @param[in] to_degree Degree when effect is ends
1989 * @param[in] axis_dir[3] rotation axis vector. it should be normalized.
1990 * @param[in] axis_pos[3] rotation axis origin position.
1991 * @param[in] cw Rotation direction. EINA_TRUE is clock wise
1992 * @return Rotation effect
1997 elm_fx_rotation3d_add(Evas_Object *obj, float from_degree, float to_degree,
1998 float* axis_dir, float* axis_pos)
2002 Elm_Fx_Rotation3d *rotation;
2007 effect = calloc(1, sizeof(Elm_Effect));
2011 rotation = calloc(1, sizeof(Elm_Fx_Rotation3d));
2019 rotation->obj = obj;
2020 rotation->from[0] = from_degree * axis_dir[0];
2021 rotation->from[1] = from_degree * axis_dir[1];
2022 rotation->from[2] = from_degree * axis_dir[2];
2023 rotation->to[0] = (to_degree * axis_dir[0]) - rotation->from[0];
2024 rotation->to[1] = (to_degree * axis_dir[1]) - rotation->from[1];
2025 rotation->to[2] = (to_degree * axis_dir[2]) - rotation->from[2];
2026 rotation->axis_pos[0] = axis_pos[0];
2027 rotation->axis_pos[1] = axis_pos[1];
2028 rotation->axis_pos[2] = axis_pos[2];
2030 effect->begin_op = _elm_fx_rotation3d_begin;
2031 effect->end_op = _elm_fx_rotation3d_end;
2032 effect->animation_op = _elm_fx_rotation3d_op;
2033 effect->user_data = rotation;
2040 /////////////////////////////////////////////////////////////////////////////////////
2041 // ImageAnimation FX
2042 /////////////////////////////////////////////////////////////////////////////////////
2043 typedef struct _image_animation Elm_Fx_Image_Animation;
2044 static void _elm_fx_image_animation_begin(void *data, Eina_Bool auto_reverse,
2045 unsigned int repeat_cnt);
2046 static void _elm_fx_image_animation_op(void *data, Elm_Animator *animator,
2048 EAPI Elm_Effect *elm_fx_image_animation_add(Evas_Object *obj, const char **images,
2049 unsigned int item_num);
2051 struct _image_animation
2060 _elm_fx_image_animation_begin(void *data, Eina_Bool auto_reverse,
2061 unsigned int repeat_cnt)
2063 Elm_Fx_Image_Animation *image_animation = data;
2064 evas_object_show(image_animation->obj);
2069 _elm_fx_image_animation_op(void *data, Elm_Animator *animator, double frame)
2071 Elm_Fx_Image_Animation *image_animation = (Elm_Fx_Image_Animation *) data;
2073 elm_icon_file_set(image_animation->obj,
2074 image_animation->images[ (int) floor(frame * (image_animation->img_cnt-1)) ], NULL);
2078 _elm_fx_image_animation_del(void *data)
2081 Elm_Fx_Image_Animation *image_animation = data;
2083 for(idx = 0; idx < image_animation->img_cnt; ++idx ) {
2084 eina_stringshare_del(image_animation->images[ idx ]);
2087 free(image_animation->images);
2091 * Add image_animation effect.
2093 * @param[in] obj Icon object
2094 * @param[in] images Array of image file path.
2095 * @param[in] img_cnt Count of image.
2096 * @return ImageAnimation effect.
2101 elm_fx_image_animation_add(Evas_Object *obj, const char **images,
2102 unsigned int img_cnt)
2105 Elm_Fx_Image_Animation *image_animation;
2108 if ((!obj) || !images || !(*images))
2111 effect = calloc(1, sizeof(Elm_Effect));
2115 image_animation = calloc(1, sizeof(Elm_Fx_Image_Animation));
2117 if (!image_animation)
2123 image_animation->obj = obj;
2124 image_animation->images = calloc( img_cnt, sizeof(char*));
2125 for(idx = 0; idx < img_cnt; ++idx )
2126 image_animation->images[ idx ] = eina_stringshare_add( images[ idx ] );
2128 image_animation->img_cnt = img_cnt;
2130 effect->begin_op = _elm_fx_image_animation_begin;
2131 effect->animation_op = _elm_fx_image_animation_op;
2132 effect->del_op = _elm_fx_image_animation_del;
2133 effect->user_data = image_animation;