summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunEon Park <chuneon.park@samsung.com>2015-04-20 14:12:27 +0900
committerChunEon Park <chuneon.park@samsung.com>2015-04-20 14:12:27 +0900
commitebd3cd06c4d758bd2aeb6400a1ee8f6fec5da0f4 (patch)
tree7cc8022fadeb90d56ecb5aa612cdb1a99b505fd4
parent5a6c25d332d085780eb76916d2fefed92d298646 (diff)
devs/hermet: updated sample
-rw-r--r--radio.c110
-rwxr-xr-xtest.c1355
2 files changed, 1355 insertions, 110 deletions
diff --git a/radio.c b/radio.c
deleted file mode 100644
index 10a4b81..0000000
--- a/radio.c
+++ /dev/null
@@ -1,110 +0,0 @@
1#include <Elementary.h>
2
3#define PACKAGE_BIN_DIR "/usr/local/bin"
4#define PACKAGE_LIB_DIR "/usr/local/lib"
5#define PACKAGE_DATA_DIR "/usr/local/share/elm_app"
6
7void elm_setup();
8
9void
10win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
11{
12 elm_exit();
13}
14
15void
16radio_changed_cb(void *data, Evas_Object *obj, void *event_info)
17{
18 printf("radio state is changed = (%d)\n", elm_radio_state_value_get(obj));
19}
20
21EAPI_MAIN int
22elm_main(int argc, char **argv)
23{
24 elm_setup();
25
26 Evas_Object *win = elm_win_util_standard_add("Elementary App", "Elementary App");
27 elm_win_autodel_set(win, EINA_TRUE);
28 evas_object_smart_callback_add(win, "delete,request", win_delete_request_cb, NULL);
29
30 Evas_Object *box = elm_box_add(win);
31 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
32 elm_win_resize_object_add(win, box);
33 evas_object_show(box);
34
35 Evas_Object *label = elm_label_add(box);
36 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
37 evas_object_size_hint_align_set(label, 0, 0.5);
38 elm_object_text_set(label, "Q. 다음 중 길거리에서 Hermet 님을 만났을 때 대처해야 할 올바른 행동을 고르시오.");
39 evas_object_show(label);
40 elm_box_pack_end(box, label);
41
42 Evas_Object *radio, *radio_group;
43
44 radio = elm_radio_add(box);
45 elm_radio_state_value_set(radio, 0);
46 elm_object_text_set(radio, "1) 일단 도망간다.");
47 evas_object_smart_callback_add(radio, "changed", radio_changed_cb, NULL);
48 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
49 evas_object_size_hint_align_set(radio, 0, EVAS_HINT_FILL);
50 evas_object_show(radio);
51 elm_box_pack_end(box, radio);
52
53 radio_group = radio;
54
55 radio = elm_radio_add(box);
56 elm_radio_state_value_set(radio, 1);
57 elm_radio_group_add(radio, radio_group);
58 elm_object_text_set(radio, "2) 혹시 아는 척 하실 수도 있으니 경계한다.");
59 evas_object_smart_callback_add(radio, "changed", radio_changed_cb, NULL);
60 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
61 evas_object_size_hint_align_set(radio, 0, EVAS_HINT_FILL);
62 evas_object_show(radio);
63 elm_box_pack_end(box, radio);
64
65 radio = elm_radio_add(box);
66 elm_radio_state_value_set(radio, 2);
67 elm_radio_group_add(radio, radio_group);
68 elm_object_text_set(radio, "3) 창피하므로 모른 척 한다.");
69 evas_object_smart_callback_add(radio, "changed", radio_changed_cb, NULL);
70 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
71 evas_object_size_hint_align_set(radio, 0, EVAS_HINT_FILL);
72 evas_object_show(radio);
73
74 elm_box_pack_end(box, radio);
75
76 radio = elm_radio_add(box);
77 elm_radio_state_value_set(radio, 3);
78 elm_radio_group_add(radio, radio_group);
79 elm_object_text_set(radio, "4) 쫓아가서 Evas_Object 가 뭔지 가능한 열정적으로 질문한다.");
80 evas_object_smart_callback_add(radio, "changed", radio_changed_cb, NULL);
81 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
82 evas_object_size_hint_align_set(radio, 0, EVAS_HINT_FILL);
83 evas_object_show(radio);
84
85 elm_box_pack_end(box, radio);
86
87 elm_radio_value_set(radio_group, 3);
88
89 evas_object_resize(win, 400, 400);
90 evas_object_show(win);
91
92 elm_run();
93
94 elm_shutdown();
95
96 return 0;
97}
98ELM_MAIN()
99
100void
101elm_setup()
102{
103 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
104 elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
105 elm_app_compile_lib_dir_set(PACKAGE_LIB_DIR);
106 elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
107 elm_app_info_set(elm_main, "Elementary App", "images/logo.png");
108}
109
110
diff --git a/test.c b/test.c
new file mode 100755
index 0000000..cdf15f5
--- /dev/null
+++ b/test.c
@@ -0,0 +1,1355 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#else
4#define PACKAGE_EXAMPLES_DIR "."
5#endif
6
7#define EFL_BETA_API_SUPPORT 1
8#define EFL_EO_API_SUPPORT 1
9
10#include <Eo.h>
11#include <Efl.h>
12#include <Elementary.h>
13
14#include <math.h>
15
16
17typedef struct vg_data_s
18{
19 Evas_Object *vg; //vector object
20 Evas_Coord_Point center; //center position of vector object
21 Elm_Transit *transit[5]; //reserved transits
22 Efl_VG_Shape *shape[5]; //reserved shape nodes
23 Ecore_Timer *timer; //reseved timer
24 int screen_w; //screen width
25 int screen_h; //screen height
26 Eina_Bool dirty;
27} vg_data;
28
29
30static void rect_toggle_chain_transits_go(vg_data *vd);
31static void circle_toggle2_chain_transits_go(vg_data *vd);
32
33static int screen_w = 0; //Screen Width
34static int screen_h = 0; //Screen Height
35
36static void
37transit_del_cb(void *data, Elm_Transit *transit)
38{
39 /* Transition is just finished. Free All resources */
40 vg_data *vd = data;
41 free(vd);
42}
43
44
45static void
46vg_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
47{
48 vg_data *vd = data;
49
50 /* Any reason, Vector object size is changed.
51 Update center position for vector drawing */
52 Evas_Coord w, h;
53 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
54 vd->center.x = (w/2);
55 vd->center.y = (h/2);
56 vd->dirty = EINA_TRUE;
57}
58
59
60Evas_Object *
61create_vg_object(Evas_Object *grid, int x, int y, int w, int h, vg_data *vd)
62{
63 /* Create a vector object and pack into a grid */
64 Evas *evas = evas_object_evas_get(grid);
65 Evas_Object *vg = evas_object_vg_add(evas);
66 evas_object_event_callback_add(vg, EVAS_CALLBACK_RESIZE, vg_resize_cb, vd);
67 evas_object_show(vg);
68
69 elm_grid_pack(grid, vg, x, y, w, h);
70
71 return vg;
72}
73
74///////////////////////////////////////////////////////////////////////////////////////////////////#/
75/* Round Rectangle Drawing */
76///////////////////////////////////////////////////////////////////////////////////////////////////
77static void
78transit_round_rect_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
79{
80 //Input Paramters
81 const double SHAPE_SIZE[2] = {10, 10};
82 const double SHAPE_SIZE_DIFF[2] = {50, 100};
83 const double SHAPE_XYR[2] = {100, 70};
84 const double SHAPE_XYR_DIFF[2] = {0, -10};
85
86 vg_data *vd = effect;
87
88
89 //Set Shape Attributes
90 evas_vg_shape_shape_reset(vd->shape[0]);
91 evas_vg_shape_shape_append_rect(vd->shape[0],
92 vd->center.x - (SHAPE_SIZE[0] / 2) - ((SHAPE_SIZE_DIFF[0] / 2) * progress),
93 vd->center.y - (SHAPE_SIZE[1] / 2) - (SHAPE_SIZE_DIFF[1] * progress),
94 SHAPE_SIZE[0] + (progress * SHAPE_SIZE_DIFF[0]),
95 SHAPE_SIZE[1] + (progress * SHAPE_SIZE_DIFF[1]),
96 10,
97 10);
98
99 evas_vg_node_color_set(vd->shape[0], 46, 160, 216, 255);
100}
101
102Eina_Bool
103timer_round_rect_cb(void *data)
104{
105 vg_data *vd = data;
106
107 //Transit for Translation
108 Elm_Transit *transit = elm_transit_add();
109 elm_transit_object_add(transit, vd->vg);
110 elm_transit_effect_translation_add(transit, 0, 0, screen_w - 200, 0);
111 elm_transit_repeat_times_set(transit, -1);
112 elm_transit_auto_reverse_set(transit, EINA_TRUE);
113 elm_transit_duration_set(transit, 2);
114
115 vd->transit[1] = transit;
116 vd->timer = NULL;
117
118 elm_transit_go(transit);
119
120 return ECORE_CALLBACK_CANCEL;
121}
122
123static void
124example_round_rect(Evas_Object *grid)
125{
126 vg_data *vd = calloc(1, sizeof(vg_data));
127
128 //Vector Object
129 Evas_Object *vg = create_vg_object(grid, 5, 5, 20, 30, vd);
130
131 //Shape Node for Vector Drawing
132 Efl_VG *root = evas_object_vg_root_node_get(vg);
133 vd->shape[0] = evas_vg_shape_add(root);
134
135 //Transit for Vector Drawing
136 Elm_Transit *transit = elm_transit_add();
137 elm_transit_object_add(transit, vg);
138 elm_transit_effect_add(transit, transit_round_rect_op, vd, NULL);
139 elm_transit_del_cb_set(transit, transit_del_cb, vd);
140 elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
141 elm_transit_repeat_times_set(transit, -1);
142 elm_transit_auto_reverse_set(transit, EINA_TRUE);
143 elm_transit_duration_set(transit, 0.35);
144
145 /* Timer
146 After 1 secs later, move the vector object */
147 vd->timer = ecore_timer_add(1, timer_round_rect_cb, vd);
148
149 vd->vg = vg;
150 vd->transit[0] = transit;
151
152 //Launch Transition
153 elm_transit_go(transit);
154}
155///////////////////////////////////////////////////////////////////////////////////////////////////
156
157
158
159
160
161
162////////////////////////////////////////////////////////////////////////////////////////////////////
163/* Circle Drawing */
164///////////////////////////////////////////////////////////////////////////////////////////////////
165static void
166transit_circle_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
167{
168 //Input Paramters
169 double CIRCLE_RADIUS = 5;
170 double CIRCLE_RADIUS_DIFF = 20;
171 int COLOR[3] = {46, 160, 216};
172 int COLOR_DIFF[3] = {209, -93, -200};
173
174 vg_data *vd = effect;
175
176 //Set Shape Attributes
177 evas_vg_shape_shape_reset(vd->shape[0]);
178 evas_vg_shape_shape_append_circle(vd->shape[0],
179 vd->center.x,
180 vd->center.y,
181 CIRCLE_RADIUS + (CIRCLE_RADIUS_DIFF * progress));
182
183 evas_vg_node_color_set(vd->shape[0],
184 COLOR[0] + (COLOR_DIFF[0] * progress),
185 COLOR[1] + (COLOR_DIFF[1] * progress),
186 COLOR[2] + (COLOR_DIFF[2] * progress),
187 255);
188}
189
190Eina_Bool
191timer_circle_cb(void *data)
192{
193 vg_data *vd = data;
194
195 //Transit for Translation
196 Elm_Transit *transit = elm_transit_add();
197 elm_transit_object_add(transit, vd->vg);
198 elm_transit_effect_translation_add(transit, 0, 0, screen_w - 200, 0);
199 elm_transit_repeat_times_set(transit, -1);
200 elm_transit_auto_reverse_set(transit, EINA_TRUE);
201 elm_transit_duration_set(transit, 2);
202
203 vd->transit[1] = transit;
204 vd->timer = NULL;
205
206 elm_transit_go(transit);
207
208 return ECORE_CALLBACK_CANCEL;
209}
210
211static void
212example_circle(Evas_Object *grid)
213{
214 vg_data *vd = calloc(1, sizeof(vg_data));
215
216 //Vector Object
217 Evas_Object *vg = create_vg_object(grid, 5, 25, 20, 10, vd);
218
219 //Shape Node for Vector Drawing
220 Efl_VG *root = evas_object_vg_root_node_get(vg);
221 vd->shape[0] = evas_vg_shape_add(root);
222
223 //Transit
224 Elm_Transit *transit = elm_transit_add();
225 elm_transit_object_add(transit, vg);
226 elm_transit_effect_add(transit, transit_circle_op, vd, NULL);
227 elm_transit_del_cb_set(transit, transit_del_cb, vd);
228 elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
229 elm_transit_repeat_times_set(transit, -1);
230 elm_transit_auto_reverse_set(transit, EINA_TRUE);
231 elm_transit_duration_set(transit, 0.35);
232
233 /* Timer
234 After 1 secs later, move the vector object */
235 vd->timer = ecore_timer_add(2, timer_circle_cb, vd);
236
237 vd->vg = vg;
238 vd->transit[0] = transit;
239
240 //Launch Transition
241 elm_transit_go(transit);
242}
243////////////////////////////////////////////////////////////////////////////////////////////////////
244
245
246
247
248
249////////////////////////////////////////////////////////////////////////////////////////////////////
250/* Circle Touch Effect Drawing */
251///////////////////////////////////////////////////////////////////////////////////////////////////
252static void
253transit_circle_touch_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
254{
255 //Input Paramters
256 double CIRCLE_RADIUS = 40;
257 double CIRCLE2_RADIUS = 30;
258 double CIRCLE2_RADIUS_DIFF = 10;
259
260 Efl_Gfx_Path_Command *path_cmd;
261 double *path_pts;
262
263 vg_data *vd = effect;
264
265 /* 1. Outer Shape */
266
267 //Set Shape Attributes
268 if (vd->dirty) {
269 vd->dirty = EINA_FALSE;
270 evas_vg_shape_shape_reset(vd->shape[0]);
271 evas_vg_shape_shape_append_circle(vd->shape[0],
272 vd->center.x,
273 vd->center.y,
274 CIRCLE_RADIUS);
275 evas_vg_node_color_set(vd->shape[0], 46, 160, 216, 255);
276 }
277 /* 2. Touch Effect Shape */
278
279 //Set Shape Attributes
280 evas_vg_shape_shape_reset(vd->shape[1]);
281 evas_vg_shape_shape_append_circle(vd->shape[1],
282 vd->center.x,
283 vd->center.y,
284 CIRCLE2_RADIUS + (CIRCLE2_RADIUS_DIFF * progress));
285 evas_vg_node_color_set(vd->shape[1], 40 - (40 * progress), 141 - (141 * progress), 165 - (165 * progress), (255 - (255 * progress)));
286}
287
288static void
289example_circle_touch(Evas_Object *grid)
290{
291 vg_data *vd = calloc(1, sizeof(vg_data));
292 vd->dirty = EINA_TRUE;
293
294 //Vector Object
295 Evas_Object *vg = create_vg_object(grid, 60, 30, 20, 20, vd);
296
297 //Shape Node for Vector Drawing
298 Efl_VG *root = evas_object_vg_root_node_get(vg);
299 vd->shape[0] = evas_vg_shape_add(root); //Outer Shape
300 vd->shape[1] = evas_vg_shape_add(root); //Touch Effect Shape
301
302 //Transit
303 Elm_Transit *transit = elm_transit_add();
304 elm_transit_object_add(transit, vg);
305 elm_transit_effect_add(transit, transit_circle_touch_op, vd, NULL);
306 elm_transit_del_cb_set(transit, transit_del_cb, vd);
307 elm_transit_repeat_times_set(transit, -1);
308 elm_transit_duration_set(transit, 1);
309 double v[4] = { 0.31, 0.06, 0.0, 1.0 };
310 elm_transit_tween_mode_factor_n_set(transit, 4, v);
311 elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE);
312
313 vd->vg = vg;
314 vd->transit[0] = transit;
315
316 //Launch Transition
317 elm_transit_go(transit);
318}
319////////////////////////////////////////////////////////////////////////////////////////////////////
320
321
322
323
324
325////////////////////////////////////////////////////////////////////////////////////////////////////
326/* Round Rect Touch Effect Drawing */
327///////////////////////////////////////////////////////////////////////////////////////////////////
328static void
329transit_round_rect_touch_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
330{
331 //Input Paramters
332 double SHAPE_SIZE[2] = {150, 70};
333 double SHAPE2_SIZE[2] = {130, 55};
334 double SHAPE2_SIZE_DIFF[2] = {20, 15};
335
336 vg_data *vd = effect;
337
338 /* 1. Outer Shape */
339
340 //Set Shape Attributes
341 if (vd->dirty) {
342 vd->dirty = EINA_FALSE;
343 evas_vg_shape_shape_reset(vd->shape[0]);
344 evas_vg_shape_shape_append_rect(vd->shape[0],
345 vd->center.x - (SHAPE_SIZE[0] / 2),
346 vd->center.y - (SHAPE_SIZE[1] / 2),
347 SHAPE_SIZE[0],
348 SHAPE_SIZE[1],
349 40,
350 100);
351 evas_vg_node_color_set(vd->shape[0], 46, 160, 216, 255);
352 }
353
354
355 /* 2. Inner Touch Effect Shape */
356
357 //Set Shape Attributes
358 evas_vg_shape_shape_reset(vd->shape[1]);
359 evas_vg_shape_shape_append_rect(vd->shape[1],
360 vd->center.x - (SHAPE2_SIZE[0] / 2) - ((SHAPE2_SIZE_DIFF[0] / 2) * progress),
361 vd->center.y - (SHAPE2_SIZE[1] / 2) - ((SHAPE2_SIZE_DIFF[1] / 2) * progress),
362 SHAPE2_SIZE[0] + (SHAPE2_SIZE_DIFF[0] * progress),
363 SHAPE2_SIZE[1] + (SHAPE2_SIZE_DIFF[1] * progress),
364 40,
365 100);
366 evas_vg_node_color_set(vd->shape[1], 40 - (40 * progress), 141 - (141 * progress), 165 - (165 * progress), 255 - (255 * progress));
367}
368
369static void
370example_round_rect_touch(Evas_Object *grid)
371{
372 vg_data *vd = calloc(1, sizeof(vg_data));
373 vd->dirty = EINA_TRUE;
374
375 //Vector Object
376 Evas_Object *vg = create_vg_object(grid, 50, 45, 50, 20, vd);
377
378 //Shape Node for Vector Drawing
379 Efl_VG *root = evas_object_vg_root_node_get(vg);
380 vd->shape[0] = evas_vg_shape_add(root); //Outer Shape
381 vd->shape[1] = evas_vg_shape_add(root); //Inner Touch Effect Shape
382
383 //Transit
384 Elm_Transit *transit = elm_transit_add();
385 elm_transit_object_add(transit, vg);
386 elm_transit_effect_add(transit, transit_round_rect_touch_op, vd, NULL);
387 elm_transit_del_cb_set(transit, transit_del_cb, vd);
388 elm_transit_repeat_times_set(transit, -1);
389 elm_transit_duration_set(transit, 1);
390 double v[4] = { 0.31, 0.06, 0.0, 1.0 };
391 elm_transit_tween_mode_factor_n_set(transit, 4, v);
392 elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_BEZIER_CURVE);
393
394 vd->vg = vg;
395 vd->transit[0] = transit;
396
397 //Launch Transition
398 elm_transit_go(transit);
399}
400////////////////////////////////////////////////////////////////////////////////////////////////////
401
402
403
404
405////////////////////////////////////////////////////////////////////////////////////////////////////
406/* Rect Check Drawing */
407///////////////////////////////////////////////////////////////////////////////////////////////////
408static void
409transit_rect_toggle_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
410{
411 //Input Paramters
412 double SHAPE_SIZE[2] = {40, 40};
413 double SHAPE2_SIZE[2] = {20, 20};
414 double SHAPE2_SIZE_DIFF[2] = {20, 20};
415
416 vg_data *vd = effect;
417
418 /* Outer Shape */
419
420 //Set Shape Attributes
421 if (vd->dirty) {
422 vd->dirty = EINA_FALSE;
423 evas_vg_shape_shape_reset(vd->shape[0]);
424 evas_vg_shape_shape_append_rect(vd->shape[0],
425 vd->center.x - (SHAPE_SIZE[0] / 2),
426 vd->center.y - (SHAPE_SIZE[1] / 2),
427 SHAPE_SIZE[0],
428 SHAPE_SIZE[1],
429 10,
430 10);
431 evas_vg_shape_stroke_width_set(vd->shape[0], 1.25);
432 evas_vg_shape_stroke_color_set(vd->shape[0], 46, 160, 216, 255);
433 }
434
435
436 /* Inner Touch Effect Shape */
437 evas_vg_shape_shape_reset(vd->shape[1]);
438 evas_vg_shape_shape_append_rect(vd->shape[1],
439 vd->center.x - (SHAPE2_SIZE[0] / 2) - ((SHAPE2_SIZE_DIFF[0] / 2) * progress) + 0.5,
440 vd->center.y - (SHAPE2_SIZE[1] / 2) - ((SHAPE2_SIZE_DIFF[1] / 2) * progress) + 0.5,
441 SHAPE2_SIZE[0] + (SHAPE2_SIZE_DIFF[0] * progress),
442 SHAPE2_SIZE[1] + (SHAPE2_SIZE_DIFF[1] * progress),
443 10,
444 10);
445 //Set Shape Attributes
446 evas_vg_node_color_set(vd->shape[1], 46 * progress, 160 * progress, 216 * progress, (255 * progress));
447}
448
449static void
450transit_rect_toggle_op2(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
451{
452 //Input Paramters
453 double LINE_MOVE_TO[2] = {-5, 10};
454 double LINE_LINE_TO[2] = {-10, -10};
455 double LINE2_MOVE_TO[2] = {-5, 10};
456 double LINE2_LINE_TO[2] = {20, -20};
457
458 vg_data *vd = effect;
459
460 /* Left Line */
461
462 //Set Shape Attributes
463 evas_vg_shape_shape_reset(vd->shape[2]);
464 evas_vg_shape_shape_append_move_to(vd->shape[2],
465 vd->center.x + LINE_MOVE_TO[0],
466 vd->center.y + LINE_MOVE_TO[1]);
467 evas_vg_shape_shape_append_line_to(vd->shape[2],
468 (vd->center.x + LINE_MOVE_TO[0]) + (LINE_LINE_TO[0] * progress),
469 (vd->center.y + LINE_MOVE_TO[1]) + (LINE_LINE_TO[1] * progress));
470 evas_vg_shape_stroke_width_set(vd->shape[2], 1.5);
471 evas_vg_shape_stroke_color_set(vd->shape[2], 255, 255, 255, 255);
472
473
474 /* Right Line */
475
476 //Set Shape Attributes
477 evas_vg_shape_shape_reset(vd->shape[3]);
478 evas_vg_shape_shape_append_move_to(vd->shape[3],
479 vd->center.x + LINE2_MOVE_TO[0],
480 vd->center.y + LINE2_MOVE_TO[1]);
481 evas_vg_shape_shape_append_line_to(vd->shape[3],
482 (vd->center.x + LINE2_MOVE_TO[0]) + (LINE2_LINE_TO[0] * progress),
483 (vd->center.y + LINE2_MOVE_TO[1]) + (LINE2_LINE_TO[1] * progress));
484 evas_vg_shape_stroke_width_set(vd->shape[3], 1.5);
485 evas_vg_shape_stroke_color_set(vd->shape[3], 255, 255, 255, 255);
486 evas_vg_shape_stroke_cap_set(vd->shape[3], EFL_GFX_CAP_ROUND);
487}
488
489static void
490transit_rect_toggle_op3(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
491{
492 //Input Paramters
493 double LINE_MOVE_TO[2] = {-5, 10};
494 double LINE_LINE_TO[2] = {-10, -10};
495 double LINE2_MOVE_TO[2] = {-5, 10};
496 double LINE2_LINE_TO[2] = {20, -20};
497
498 vg_data *vd = effect;
499
500 /* Left Line */
501
502 //Set Shape Attributes
503 evas_vg_shape_shape_reset(vd->shape[2]);
504 evas_vg_shape_shape_append_move_to(vd->shape[2],
505 vd->center.x + LINE_MOVE_TO[0],
506 vd->center.y + LINE_MOVE_TO[1]);
507 evas_vg_shape_shape_append_line_to(vd->shape[2],
508 (vd->center.x + LINE_MOVE_TO[0]) + (LINE_LINE_TO[0] - LINE_LINE_TO[0] * progress),
509 (vd->center.y + LINE_MOVE_TO[1]) + (LINE_LINE_TO[1] - LINE_LINE_TO[1] * progress));
510
511 /* Right Line */
512 evas_vg_shape_shape_reset(vd->shape[3]);
513 evas_vg_shape_shape_append_move_to(vd->shape[3],
514 vd->center.x + LINE2_MOVE_TO[0],
515 vd->center.y + LINE2_MOVE_TO[1]);
516 evas_vg_shape_shape_append_line_to(vd->shape[3],
517 (vd->center.x + LINE2_MOVE_TO[0]) + (LINE2_LINE_TO[0] - LINE2_LINE_TO[0] * progress),
518 (vd->center.y + LINE2_MOVE_TO[1]) + (LINE2_LINE_TO[1] - LINE2_LINE_TO[1] * progress));
519}
520
521static void
522transit_rect_toggle_op4(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
523{
524 Efl_Gfx_Path_Command *path_cmd;
525 double *path_pts;
526
527 vg_data *vd = effect;
528
529 /* Inner Touch Effect */
530
531 //Set Shape Attributes
532 evas_vg_node_color_set(vd->shape[1], 46 - (46 * progress), 160 - (160 * progress), 216 - (216 * progress), 255 - (255 * progress));
533}
534
535static void
536transit_rect_toggle_del_cb(void *data, Elm_Transit *transit)
537{
538 /* Final Transition is finished, repeat the transitions */
539 vg_data *vd = data;
540 rect_toggle_chain_transits_go(vd);
541}
542
543static void
544rect_toggle_chain_transits_go(vg_data *vd)
545{
546 //Transit - Fill Background
547 Elm_Transit *transit = elm_transit_add();
548 elm_transit_object_add(transit, vd->vg);
549 elm_transit_effect_add(transit, transit_rect_toggle_op, vd, NULL);
550 elm_transit_duration_set(transit, 0.5);
551 elm_transit_objects_final_state_keep_set(transit, EINA_TRUE);
552
553 //Transit - Check Drawing
554 Elm_Transit *transit2 = elm_transit_add();
555 elm_transit_object_add(transit2, vd->vg);
556 elm_transit_effect_add(transit2, transit_rect_toggle_op2, vd, NULL);
557 elm_transit_duration_set(transit2, 0.35);
558
559 //Transit - Revert Check Drawing
560 Elm_Transit *transit3 = elm_transit_add();
561 elm_transit_object_add(transit3, vd->vg);
562 elm_transit_effect_add(transit3, transit_rect_toggle_op3, vd, NULL);
563 elm_transit_duration_set(transit3, 0.35);
564
565 //Transit - Revert Background
566 Elm_Transit *transit4 = elm_transit_add();
567 elm_transit_object_add(transit4, vd->vg);
568 elm_transit_effect_add(transit4, transit_rect_toggle_op4, vd, NULL);
569 elm_transit_del_cb_set(transit4, transit_rect_toggle_del_cb, vd);
570 elm_transit_duration_set(transit4, 0.5);
571
572 //Chain Transits
573 elm_transit_chain_transit_add(transit, transit2);
574 elm_transit_chain_transit_add(transit2, transit3);
575 elm_transit_chain_transit_add(transit3, transit4);
576
577 vd->transit[0] = transit;
578 vd->transit[1] = transit2;
579 vd->transit[2] = transit3;
580 vd->transit[3] = transit4;
581
582 //Launch Transition
583 elm_transit_go(transit);
584}
585
586static void
587example_rect_toggle(Evas_Object *grid)
588{
589 vg_data *vd = calloc(1, sizeof(vg_data));
590 vd->dirty = EINA_TRUE;
591 //Vector Object
592 Evas_Object *vg = create_vg_object(grid, 5, 35, 20, 10, vd);
593
594 //Shape Node for Vector Drawing
595 Efl_VG *root = evas_object_vg_root_node_get(vg);
596 vd->shape[0] = evas_vg_shape_add(root); //Outer Shape
597 vd->shape[1] = evas_vg_shape_add(root); //Inner Touch Effect Shape
598 vd->shape[2] = evas_vg_shape_add(root); //Left Line
599 vd->shape[3] = evas_vg_shape_add(root); //Right Line
600
601 vd->vg = vg;
602
603 rect_toggle_chain_transits_go(vd);
604}
605////////////////////////////////////////////////////////////////////////////////////////////////////
606
607
608
609
610
611
612////////////////////////////////////////////////////////////////////////////////////////////////////
613/* Circle Toggle Drawing */
614///////////////////////////////////////////////////////////////////////////////////////////////////
615static void
616transit_circle_toggle_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
617{
618 //Input Paramters
619 double CIRCLE_RADIUS = 25;
620 double CIRCLE2_RADIUS = 17;
621 double CIRCLE2_RADIUS_DIFF = 5;
622 double CIRCLE3_RADIUS = 13;
623 double CIRCLE3_RADIUS_DIFF = -13;
624
625 vg_data *vd = effect;
626
627 /* Outer Circle */
628
629 //Set Shape Attributes
630 evas_vg_shape_shape_reset(vd->shape[0]);
631 evas_vg_shape_shape_append_circle(vd->shape[0],
632 vd->center.x,
633 vd->center.y,
634 CIRCLE_RADIUS);
635 evas_vg_node_color_set(vd->shape[0], 101 - 51 * (progress), 180 - 90 * (progress), 233 - 116 * (progress), 255 - 127 * (progress));
636 evas_vg_shape_stroke_color_set(vd->shape[0], 46, 160, 216, 255);
637 evas_vg_shape_stroke_width_set(vd->shape[0], 1);
638
639
640 /* Middle Circle */
641
642 //Set Shape Attributes
643 evas_vg_shape_shape_reset(vd->shape[1]);
644 evas_vg_shape_shape_append_circle(vd->shape[1],
645 vd->center.x,
646 vd->center.y,
647 CIRCLE2_RADIUS + (CIRCLE2_RADIUS_DIFF * progress));
648 evas_vg_node_color_set(vd->shape[1], 255, 255, 255, 255);
649
650
651 /* Inner Circle */
652
653 //Set Shape Attribute
654 evas_vg_shape_shape_reset(vd->shape[2]);
655 evas_vg_shape_shape_append_circle(vd->shape[2],
656 vd->center.x,
657 vd->center.y,
658 CIRCLE3_RADIUS + (CIRCLE3_RADIUS_DIFF * progress));
659 evas_vg_node_color_set(vd->shape[2], 46 - 23 * (progress), 160 - 80 * (progress), 216 - 108 * (progress), 255 - (127 * progress));
660}
661
662static void
663example_circle_toggle(Evas_Object *grid)
664{
665 vg_data *vd = calloc(1, sizeof(vg_data));
666
667 //Vector Object
668 Evas_Object *vg = create_vg_object(grid, 30, 33, 15, 15, vd);
669
670 //Shape Node for Vector Drawing
671 Efl_VG *root = evas_object_vg_root_node_get(vg);
672 vd->shape[0] = evas_vg_shape_add(root); //Outer Shape
673 vd->shape[1] = evas_vg_shape_add(root); //Middle Shape
674 vd->shape[2] = evas_vg_shape_add(root); //Inner Shape
675
676 //Transit
677 Elm_Transit *transit = elm_transit_add();
678 elm_transit_object_add(transit, vg);
679 elm_transit_effect_add(transit, transit_circle_toggle_op, vd, NULL);
680 elm_transit_del_cb_set(transit, transit_del_cb, vd);
681 elm_transit_repeat_times_set(transit, -1);
682 elm_transit_auto_reverse_set(transit, EINA_TRUE);
683 elm_transit_duration_set(transit, 0.5);
684
685 vd->vg = vg;
686 vd->transit[0] = transit;
687
688 //Launch Transition
689 elm_transit_go(transit);
690}
691////////////////////////////////////////////////////////////////////////////////////////////////////
692
693
694
695
696
697
698
699////////////////////////////////////////////////////////////////////////////////////////////////////
700/* Morphing Circle Toggle Drawing */
701///////////////////////////////////////////////////////////////////////////////////////////////////
702static void
703transit_circle_toggle2_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
704{
705 //Input Parameters
706 double CIRCLE_RADIUS = 35;
707 int COLOR[3] = {129, 138, 140};
708 int COLOR_DIFF[3] = {-85, 6, -67};
709
710 vg_data *vd = effect;
711
712 /* Outer Shape */
713
714 //Set Shape Attributes
715 if (vd->dirty) {
716 vd->dirty = EINA_FALSE;
717 evas_vg_shape_shape_reset(vd->shape[0]);
718 evas_vg_shape_shape_append_circle(vd->shape[0],
719 vd->center.x,
720 vd->center.y,
721 CIRCLE_RADIUS);
722 evas_vg_shape_stroke_width_set(vd->shape[0], 1);
723 }
724
725 evas_vg_node_color_set(vd->shape[0],
726 COLOR[0] + (progress * COLOR_DIFF[0]),
727 COLOR[1] + (progress * COLOR_DIFF[1]),
728 COLOR[2] + (progress * COLOR_DIFF[2]),
729 255);
730}
731
732static void
733transit_circle_toggle2_op2(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
734{
735 //Input Parameters
736 const double LINE_Y_HALF = 20;
737
738 vg_data *vd = effect;
739
740 /* Inner Line */
741
742 //Set Shape Attributes
743 evas_vg_shape_shape_reset(vd->shape[1]);
744 evas_vg_shape_shape_append_move_to(vd->shape[1],
745 vd->center.x,
746 vd->center.y - LINE_Y_HALF + (LINE_Y_HALF * progress));
747 evas_vg_shape_shape_append_line_to(vd->shape[1],
748 vd->center.x,
749 vd->center.y + LINE_Y_HALF - (LINE_Y_HALF * progress));
750
751 evas_vg_shape_stroke_width_set(vd->shape[1], 1.75);
752 evas_vg_shape_stroke_cap_set(vd->shape[1], EFL_GFX_CAP_ROUND);
753 evas_vg_shape_stroke_color_set(vd->shape[1], 255, 255, 255, 255);
754}
755
756static void
757transit_circle_toggle2_op3(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
758{
759 //Input Parameters
760 double CIRCLE_RADIUS = 0;
761 double CIRCLE_RADIUS_DIFF = 20;
762
763 vg_data *vd = effect;
764
765 /* Inner Circle */
766
767 //Set Shape Attributes
768 evas_vg_shape_shape_reset(vd->shape[2]);
769 evas_vg_shape_shape_append_circle(vd->shape[2],
770 vd->center.x,
771 vd->center.y,
772 CIRCLE_RADIUS + (CIRCLE_RADIUS_DIFF * progress));
773 evas_vg_shape_stroke_width_set(vd->shape[2], 1.5);
774 evas_vg_shape_stroke_color_set(vd->shape[2], 255, 255, 255, 255);
775}
776
777static void
778transit_circle_toggle2_op4(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
779{
780 //Input Parameters
781 const double LINE_Y_HALF = 20;
782
783 vg_data *vd = effect;
784
785 /* Inner Line */
786
787 //Set Shape Attributes
788 evas_vg_shape_shape_reset(vd->shape[1]);
789 evas_vg_shape_shape_append_move_to(vd->shape[1],
790 vd->center.x,
791 vd->center.y - LINE_Y_HALF + (LINE_Y_HALF * (1 - progress)));
792 evas_vg_shape_shape_append_line_to(vd->shape[1],
793 vd->center.x,
794 vd->center.y + LINE_Y_HALF - (LINE_Y_HALF * (1 - progress)));
795}
796
797static void
798transit_circle_toggle2_del_cb(void *data, Elm_Transit *transit)
799{
800 vg_data *vd = data;
801 circle_toggle2_chain_transits_go(vd);
802}
803
804static void
805circle_toggle2_chain_transits_go(vg_data *vd)
806{
807 //Transit 1 - Line
808 Elm_Transit *transit = elm_transit_add();
809 elm_transit_object_add(transit, vd->vg);
810 elm_transit_effect_add(transit, transit_circle_toggle2_op2, vd, NULL);
811 elm_transit_duration_set(transit, 0.25);
812 elm_transit_objects_final_state_keep_set(transit, EINA_TRUE);
813
814 //Transit 2 - Circle
815 Elm_Transit *transit2 = elm_transit_add();
816 elm_transit_object_add(transit2, vd->vg);
817 elm_transit_effect_add(transit2, transit_circle_toggle2_op3, vd, NULL);
818 elm_transit_duration_set(transit2, 0.25);
819 elm_transit_auto_reverse_set(transit2, EINA_TRUE);
820 elm_transit_objects_final_state_keep_set(transit2, EINA_TRUE);
821
822 //Transit 3 - Line (Reverse)
823 Elm_Transit *transit3 = elm_transit_add();
824 elm_transit_object_add(transit3, vd->vg);
825 elm_transit_effect_add(transit3, transit_circle_toggle2_op4, vd, NULL);
826 elm_transit_duration_set(transit3, 0.25);
827 elm_transit_objects_final_state_keep_set(transit3, EINA_TRUE);
828 elm_transit_del_cb_set(transit3, transit_circle_toggle2_del_cb, vd);
829
830 elm_transit_chain_transit_add(transit, transit2);
831 elm_transit_chain_transit_add(transit2, transit3);
832
833 vd->transit[1] = transit;
834 vd->transit[2] = transit2;
835 vd->transit[3] = transit3;
836
837 elm_transit_go(transit);
838}
839
840static void
841example_circle_toggle2(Evas_Object *grid)
842{
843 vg_data *vd = calloc(1, sizeof(vg_data));
844 vd->dirty = EINA_TRUE;
845
846 //Vector Object
847 Evas_Object *vg = create_vg_object(grid, 30, 45, 20, 20, vd);
848
849 Efl_VG *root = evas_object_vg_root_node_get(vg);
850 vd->shape[0] = evas_vg_shape_add(root); //Outer Shape
851 vd->shape[1] = evas_vg_shape_add(root); //Inner Line Shape
852 vd->shape[2] = evas_vg_shape_add(root); //Inner Circle Shape
853
854 //Transit
855 Elm_Transit *transit = elm_transit_add();
856 elm_transit_object_add(transit, vg);
857 elm_transit_effect_add(transit, transit_circle_toggle2_op, vd, NULL);
858 elm_transit_repeat_times_set(transit, -1);
859 elm_transit_auto_reverse_set(transit, EINA_TRUE);
860 elm_transit_duration_set(transit, 0.5);
861
862 vd->vg = vg;
863 vd->transit[0] = transit;
864
865 //Launch Transition
866 elm_transit_go(transit);
867
868 circle_toggle2_chain_transits_go(vd);
869}
870////////////////////////////////////////////////////////////////////////////////////////////////////
871
872
873
874
875
876
877
878////////////////////////////////////////////////////////////////////////////////////////////////////
879/* Star Toggle Drawing */
880///////////////////////////////////////////////////////////////////////////////////////////////////
881static void
882transit_star_toggle_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
883{
884 //Input Parameters
885 #define PT_CNT 10
886 const double STAR_PT[PT_CNT][2] = {{0, -20}, {5, -5}, {20, -5}, {7, 4}, {13, 20},
887 {0, 12}, {-13, 20}, {-7, 4}, {-20, -5}, {-5, -5}};
888
889 int i;
890 double diff[2];
891
892 vg_data *vd = effect;
893
894 /* Outer Shape */
895 if (vd->dirty) {
896 vd->dirty = EINA_FALSE;
897 evas_vg_shape_shape_reset(vd->shape[0]);
898 evas_vg_shape_shape_append_move_to(vd->shape[0],
899 vd->center.x + STAR_PT[0][0],
900 vd->center.y + STAR_PT[0][1]);
901 for (i = 1; i < PT_CNT; i++) {
902 evas_vg_shape_shape_append_line_to(vd->shape[0],
903 vd->center.x + STAR_PT[i][0],
904 vd->center.y + STAR_PT[i][1]);
905 }
906 evas_vg_shape_shape_append_close(vd->shape[0]);
907
908 //Set Shape Attributes
909 evas_vg_shape_stroke_color_set(vd->shape[0], 247, 178, 26, 255);
910 evas_vg_shape_stroke_width_set(vd->shape[0], 1);
911 evas_vg_shape_stroke_join_set(vd->shape[0], EFL_GFX_JOIN_ROUND);
912 }
913
914 Eina_Matrix3 translate;
915 eina_matrix3_translate(&translate, vd->center.x, vd->center.y);
916
917
918 Eina_Matrix3 rotate;
919 double radian = 360 * progress * 2 * 3.141 / 360.0;
920 eina_matrix3_rotate(&rotate, radian);
921
922 Eina_Matrix3 scale;
923 eina_matrix3_scale(&scale, 1 + .5 * progress, 1 + .5 * progress);
924
925 Eina_Matrix3 result1;
926 eina_matrix3_compose(&translate, &scale, &result1);
927
928 Eina_Matrix3 result2;
929 eina_matrix3_compose(&result1, &rotate, &result2);
930
931 eina_matrix3_translate(&translate, -vd->center.x, -vd->center.y);
932
933 Eina_Matrix3 result;
934 eina_matrix3_compose(&result2, &translate, &result);
935 evas_vg_node_transformation_set(vd->shape[0], &result);
936
937 /* Inner Shape */
938
939 //Set Shape Attributes
940 diff[0] = (STAR_PT[0][0] * (progress * 0.65 + 0.35));
941 diff[1] = (STAR_PT[0][1]) * (progress * 0.65 + 0.35);
942 evas_vg_shape_shape_reset(vd->shape[1]);
943 evas_vg_shape_shape_append_move_to(vd->shape[1],
944 vd->center.x + diff[0] + 0.5,
945 vd->center.y + diff[1] + 0.5);
946 for (i = 1; i < PT_CNT; i++)
947 {
948 diff[0] = (STAR_PT[i][0] * (progress * 0.65 + 0.35));
949 diff[1] = (STAR_PT[i][1]) * (progress * 0.65 + 0.35);
950 evas_vg_shape_shape_append_line_to(vd->shape[1],
951 vd->center.x + diff[0] + 0.5,
952 vd->center.y + diff[1] + 0.5);
953 }
954 evas_vg_shape_shape_append_close(vd->shape[1]);
955
956 evas_vg_node_color_set(vd->shape[1], 247 * progress, 178 * progress, 26 * progress, 255 * progress);
957 evas_vg_shape_stroke_color_set(vd->shape[1], 247 * progress, 178 * progress, 26 * progress, 255 * progress);
958 evas_vg_shape_stroke_join_set(vd->shape[1], EFL_GFX_JOIN_ROUND);
959 evas_vg_node_transformation_set(vd->shape[1], &result);
960}
961
962example_star_toggle(Evas_Object *grid)
963{
964 vg_data *vd = calloc(1, sizeof(vg_data));
965 vd->dirty = EINA_TRUE;
966 //Vector Object
967 Evas_Object *vg = create_vg_object(grid, 5, 45, 20, 20, vd);
968
969 Efl_VG *root = evas_object_vg_root_node_get(vg);
970 vd->shape[0] = evas_vg_shape_add(root); //Outer Shape
971 vd->shape[1] = evas_vg_shape_add(root); //Inner Line Shape
972
973 //Transit
974 Elm_Transit *transit = elm_transit_add();
975 elm_transit_object_add(transit, vg);
976 elm_transit_effect_add(transit, transit_star_toggle_op, vd, NULL);
977 elm_transit_repeat_times_set(transit, -1);
978 elm_transit_auto_reverse_set(transit, EINA_TRUE);
979 elm_transit_duration_set(transit, 1.5);
980 elm_transit_del_cb_set(transit, transit_del_cb, vd);
981
982 vd->vg = vg;
983 vd->transit[0] = transit;
984
985 //Launch Transition
986 elm_transit_go(transit);
987}
988////////////////////////////////////////////////////////////////////////////////////////////////////
989
990
991
992
993
994
995
996
997
998
999////////////////////////////////////////////////////////////////////////////////////////////////////
1000/* Line Progress Drawing */
1001///////////////////////////////////////////////////////////////////////////////////////////////////
1002static void
1003transit_progress_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
1004{
1005 //Input Parameters
1006 double LINE_HALF_SIZE = 200;
1007
1008 double pos;
1009 double v[4];
1010
1011 vg_data *vd = effect;
1012
1013 /* Outer Shape */
1014
1015 //Set Shape Attributes
1016 if (vd->dirty) {
1017 vd->dirty = EINA_FALSE;
1018 evas_vg_shape_shape_reset(vd->shape[0]);
1019 evas_vg_shape_shape_append_move_to(vd->shape[0],
1020 vd->center.x - LINE_HALF_SIZE,
1021 vd->center.y);
1022 evas_vg_shape_shape_append_line_to(vd->shape[0],
1023 vd->center.x + LINE_HALF_SIZE,
1024 vd->center.y);
1025 evas_vg_shape_stroke_color_set(vd->shape[0], 203, 205, 206, 255);
1026 evas_vg_shape_stroke_width_set(vd->shape[0], 4);
1027 evas_vg_shape_stroke_cap_set(vd->shape[0], EFL_GFX_CAP_ROUND);
1028 }
1029
1030
1031 /* Fill Line Shape */
1032
1033 //Set Shape Attributes
1034 evas_vg_shape_shape_reset(vd->shape[1]);
1035 evas_vg_shape_shape_append_move_to(vd->shape[1],
1036 vd->center.x - LINE_HALF_SIZE,
1037 vd->center.y);
1038 v[0] = 0.15;
1039 v[1] = 0.84;
1040 v[2] = 0.28;
1041 v[3] = 0.96;
1042 pos = ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, v);
1043
1044 evas_vg_shape_shape_append_line_to(vd->shape[1],
1045 vd->center.x - LINE_HALF_SIZE + (LINE_HALF_SIZE * 2 * pos),
1046 vd->center.y);
1047 evas_vg_shape_stroke_color_set(vd->shape[1], 181, 225, 236, 255);
1048 evas_vg_shape_stroke_width_set(vd->shape[1], 4);
1049 evas_vg_shape_stroke_cap_set(vd->shape[1], EFL_GFX_CAP_ROUND);
1050
1051
1052 /* Cursor Shape */
1053 pos = ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, v);
1054
1055 v[0] = 0.33;
1056 v[1] = 0.66;
1057 v[2] = 0.76;
1058 v[3] = 0.8;
1059 pos = ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, v);
1060 evas_vg_shape_shape_reset(vd->shape[2]);
1061 evas_vg_shape_shape_append_move_to(vd->shape[2],
1062 vd->center.x - LINE_HALF_SIZE + (LINE_HALF_SIZE * 2 * pos),
1063 vd->center.y);
1064 v[0] = 0.15;
1065 v[1] = 0.84;
1066 v[2] = 0.28;
1067 v[3] = 0.96;
1068 pos = ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, v);
1069
1070 evas_vg_shape_shape_append_line_to(vd->shape[2],
1071 vd->center.x - LINE_HALF_SIZE + (LINE_HALF_SIZE * 2 * pos),
1072 vd->center.y);
1073 //Set Shape Attributes
1074 evas_vg_shape_stroke_color_set(vd->shape[2], 48, 170, 204, 255);
1075 evas_vg_shape_stroke_width_set(vd->shape[2], 4);
1076 evas_vg_shape_stroke_cap_set(vd->shape[2], EFL_GFX_CAP_ROUND);
1077}
1078
1079static void
1080example_progress(Evas_Object *grid)
1081{
1082 vg_data *vd = calloc(1, sizeof(vg_data));
1083 vd->dirty = EINA_TRUE;
1084 //Vector Object
1085 Evas_Object *vg = create_vg_object(grid, 0, 65, 100, 5, vd);
1086
1087 Efl_VG *root = evas_object_vg_root_node_get(vg);
1088 vd->shape[0] = evas_vg_shape_add(root); //BG Shape
1089 vd->shape[1] = evas_vg_shape_add(root); //Fill Line Shape
1090 vd->shape[2] = evas_vg_shape_add(root); //Cursor Shape
1091
1092 //Transit
1093 Elm_Transit *transit = elm_transit_add();
1094 elm_transit_object_add(transit, vg);
1095 elm_transit_effect_add(transit, transit_progress_op, vd, NULL);
1096 elm_transit_repeat_times_set(transit, -1);
1097 elm_transit_duration_set(transit, 1);
1098 elm_transit_del_cb_set(transit, transit_del_cb, vd);
1099
1100 vd->vg = vg;
1101 vd->transit[0] = transit;
1102
1103 //Launch Transition
1104 elm_transit_go(transit);
1105}
1106////////////////////////////////////////////////////////////////////////////////////////////////////
1107
1108
1109
1110
1111
1112
1113
1114////////////////////////////////////////////////////////////////////////////////////////////////////
1115/* Circle Progress Drawing */
1116///////////////////////////////////////////////////////////////////////////////////////////////////
1117static void
1118transit_progress2_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
1119{
1120 //Input Parameters
1121 const double CIRCLE_RADIUS = 50;
1122
1123 double *path_pts;
1124 double pos, pos2;
1125 double v[4];
1126 double v2[4];
1127
1128 vg_data *vd = effect;
1129
1130 /* Outer Shape */
1131
1132 //Set Shape Attributes
1133 v[0] = 0.0;
1134 v[1] = 1.0;
1135 v[2] = 0.7;
1136 v[3] = 0.94;
1137 pos = ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, v);
1138
1139 v2[0] = 0.73;
1140 v2[1] = 0.79;
1141 v2[2] = 0.7;
1142 v2[3] = 0.94;
1143 pos2 = ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, v2);
1144
1145 // evas_vg_shape_shape_append_arc(vd->shape[0],
1146 // 10,
1147 // 50,
1148 // 2 * CIRCLE_RADIUS,
1149 // 2 * CIRCLE_RADIUS,
1150 // 90 + (-360 * pos2),
1151 // -360 * pos - (-360 * pos2));
1152
1153 evas_vg_shape_stroke_color_set(vd->shape[0], 181, 225, 236, 255);
1154 evas_vg_shape_stroke_width_set(vd->shape[0], 4);
1155 evas_vg_shape_stroke_cap_set(vd->shape[0], EFL_GFX_CAP_ROUND);
1156
1157
1158 /* Inner Shape */
1159
1160 //Set Shape Attributes
1161 v[0] = 0.0;
1162 v[1] = 1.0;
1163 v[2] = 0.7;
1164 v[3] = 0.94;
1165 pos = ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, v);
1166
1167 v2[0] = 0.33;
1168 v2[1] = 0.79;
1169 v2[2] = 0.7;
1170 v2[3] = 0.94;
1171 pos2 = ecore_animator_pos_map_n(progress, ECORE_POS_MAP_CUBIC_BEZIER, 4, v2);
1172
1173 // evas_vg_shape_shape_append_arc(vd->shape[1],
1174 // 10,
1175 // 50,
1176 // 2 * CIRCLE_RADIUS,
1177 // 2 * CIRCLE_RADIUS,
1178 // 90 + (-360 * pos2),
1179 // -360 * pos - (-360 * pos2));
1180
1181 evas_vg_shape_stroke_color_set(vd->shape[1], 48, 170, 204, 255);
1182 evas_vg_shape_stroke_width_set(vd->shape[1], 4);
1183 evas_vg_shape_stroke_cap_set(vd->shape[1], EFL_GFX_CAP_ROUND);
1184}
1185
1186static void
1187example_progress2(Evas_Object *grid)
1188{
1189 vg_data *vd = calloc(1, sizeof(vg_data));
1190
1191 //Vector Object
1192 Evas_Object *vg = create_vg_object(grid, 5, 70, 50, 30, vd);
1193
1194 Efl_VG *root = evas_object_vg_root_node_get(vg);
1195 vd->shape[0] = evas_vg_shape_add(root); //Fill Line Shape
1196 vd->shape[1] = evas_vg_shape_add(root); //Cursor Shape
1197
1198 //Transit
1199 Elm_Transit *transit = elm_transit_add();
1200 elm_transit_object_add(transit, vg);
1201 elm_transit_effect_add(transit, transit_progress2_op, vd, NULL);
1202 elm_transit_repeat_times_set(transit, -1);
1203 elm_transit_duration_set(transit, 1);
1204 elm_transit_del_cb_set(transit, transit_del_cb, vd);
1205
1206 vd->vg = vg;
1207 vd->transit[0] = transit;
1208
1209 //Launch Transition
1210 elm_transit_go(transit);
1211}
1212////////////////////////////////////////////////////////////////////////////////////////////////////
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223////////////////////////////////////////////////////////////////////////////////////////////////////
1224/* Index Drawing */
1225///////////////////////////////////////////////////////////////////////////////////////////////////
1226static void
1227transit_index_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double progress)
1228{
1229 //Input Parameters
1230 const double CIRCLE_RADIUS = 45;
1231 const double CIRCLE_RADIUS_DIFF = 5;
1232 const double MOVE_Y = 20;
1233
1234 vg_data *vd = effect;
1235
1236 /* Outer Shape */
1237
1238 //Set Shape Attributes
1239 evas_vg_shape_shape_reset(vd->shape[0]);
1240 evas_vg_shape_shape_append_circle(vd->shape[0],
1241 vd->center.x,
1242 vd->center.y - (MOVE_Y * progress),
1243 CIRCLE_RADIUS + (CIRCLE_RADIUS_DIFF * progress));
1244 evas_vg_node_color_set(vd->shape[0], 46 * progress, 160 * progress, 216 * progress, 255 * progress);
1245}
1246
1247
1248static void
1249example_index(Evas_Object *grid)
1250{
1251 vg_data *vd = calloc(1, sizeof(vg_data));
1252
1253 //Vector Object
1254 Evas_Object *vg = create_vg_object(grid, 50, 70, 50, 30, vd);
1255
1256 Efl_VG *root = evas_object_vg_root_node_get(vg);
1257 vd->shape[0] = evas_vg_shape_add(root); //Circle
1258
1259 //Transit
1260 Elm_Transit *transit = elm_transit_add();
1261 elm_transit_object_add(transit, vg);
1262 elm_transit_effect_add(transit, transit_index_op, vd, NULL);
1263 elm_transit_repeat_times_set(transit, -1);
1264 elm_transit_duration_set(transit, 1);
1265 elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_DECELERATE);
1266 elm_transit_auto_reverse_set(transit, EINA_TRUE);
1267 elm_transit_del_cb_set(transit, transit_del_cb, vd);
1268
1269 vd->vg = vg;
1270 vd->transit[0] = transit;
1271
1272 //Launch Transition
1273 elm_transit_go(transit);
1274}
1275////////////////////////////////////////////////////////////////////////////////////////////////////
1276
1277
1278
1279
1280
1281
1282int
1283elm_main(int argc, char **argv)
1284{
1285 //Window
1286 Evas_Object *win = elm_win_util_standard_add("test", "test");
1287 elm_win_title_set(win, "Vector");
1288 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
1289 elm_win_autodel_set(win, EINA_TRUE);
1290 elm_win_screen_size_get(win, NULL, NULL, &screen_w, &screen_h);
1291
1292 //Background
1293 Evas_Object *bg = elm_button_add(win);
1294 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1295 elm_win_resize_object_add(win, bg);
1296 evas_object_show(bg);
1297
1298 //Naviframe
1299 Evas_Object *nf = elm_naviframe_add(win);
1300 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1301 elm_win_resize_object_add(win, nf);
1302 evas_object_show(nf);
1303
1304 Evas_Object *grid = elm_grid_add(nf);
1305
1306
1307 //Scalable Round Rectangle
1308 example_round_rect(grid);
1309
1310 //Scalable Circle // 10,
1311 // 50,
1312 // 2 * CIRCLE_RADIUS,
1313 // 2 * CIRCLE_RADIUS,
1314 // 90 + (-360 * pos2),
1315 // -360 * pos - (-360 * pos2));
1316 example_circle(grid);
1317
1318 // //Circle Touch Effect
1319 example_circle_touch(grid);
1320
1321 // //Round Rect Touch Effect
1322 example_round_rect_touch(grid);
1323
1324 //Rectangular Toggle
1325 example_rect_toggle(grid);
1326
1327 //Stripe Circle Toggle
1328 example_circle_toggle(grid);
1329
1330 //Morphing Circle Toggle
1331 example_circle_toggle2(grid);
1332
1333 //Start Toggle
1334 example_star_toggle(grid);
1335
1336 //Line Progress
1337 example_progress(grid);
1338
1339 //Circle Progress
1340 //example_progress2(grid);
1341
1342 //Index
1343 example_index(grid);
1344
1345 elm_naviframe_item_push(nf, "Vector Drawing", NULL, NULL, grid, NULL);
1346
1347 evas_object_resize(win, 480, 800);
1348 evas_object_show(win);
1349
1350 elm_run();
1351 elm_shutdown();
1352
1353 return 0;
1354}
1355ELM_MAIN()