summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_efl_gfx_vg_value_provider.c
blob: 9a800e79c224db2d2034e588ca7634d9629a167d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Elementary.h>
#include <Efl_Ui.h>
#include "elm_priv.h"

#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif

#ifndef EFL_EO_API_SUPPORT
#define EFL_EO_API_SUPPORT
#endif

#ifdef BUILD_VG_LOADER_JSON

Evas_Object *values[4], *anim_view;
Evas_Object *path_entry, *type_hoversel;

Eina_Bool
add_value_provider(char* new_path, char* new_type, char* new_values)
{
   const char* type = elm_object_text_get(type_hoversel);
   if (!type) return EINA_FALSE;
   const char* path = efl_text_get(path_entry);
   if (!path) return EINA_FALSE;

   if (strstr(type, "Color") != NULL)
     {
        int color[4];
        Eo *vp = efl_add(EFL_GFX_VG_VALUE_PROVIDER_CLASS, anim_view);
        efl_gfx_vg_value_provider_keypath_set(vp, (char*)path);
        for (int i = 0; i < 4; i++)
          {
             char* v = (char*)efl_text_get(values[i]);
             if (v) color[i] = atoi(v);
          }

        sprintf(new_path, "%s", path);
        sprintf(new_values, "%d %d %d %d",color[0], color[1], color[2], color[3]);
        if (!strcmp(type, "FillColor"))
          {
             efl_gfx_vg_value_provider_fill_color_set(vp, color[0], color[1], color[2], color[3]);
             sprintf(new_type, "FillColor");
          }
        if (!strcmp(type, "StrokeColor")) 
          {
             efl_gfx_vg_value_provider_stroke_color_set(vp, color[0], color[1], color[2], color[3]);
             sprintf(new_type, "StrokeColor");
          }


        efl_ui_animation_view_value_provider_override(anim_view, vp);
     }
   if (!strcmp(type, "StrokeWidth"))
     {
        double width;
        Eo *vp = efl_add(EFL_GFX_VG_VALUE_PROVIDER_CLASS, anim_view);
        efl_gfx_vg_value_provider_keypath_set(vp, (char*)path);
        char* v = (char*)efl_text_get(values[0]);
        if (v) width = strtod(v, NULL);
        efl_gfx_vg_value_provider_stroke_width_set(vp, width);
        efl_ui_animation_view_value_provider_override(anim_view, vp);
        evas_object_show(anim_view);
        sprintf(new_path, "%s", path);
        sprintf(new_type, "StrokeWidth");
        sprintf(new_values, "%f", width);
     }
   return EINA_TRUE;
}

static void
btn_clicked_cb(void *data , const Efl_Event *ev )
{
   const char *text = efl_text_get(ev->object);

   if (!text) return;

   if (!strcmp("Play", text))
     efl_ui_animation_view_play((Evas_Object*)data);
   else if (!strcmp("Pause", text))
     efl_ui_animation_view_pause((Evas_Object*)data);
   else if (!strcmp("Resume", text))
     efl_ui_animation_view_resume((Evas_Object*)data);
   else if (!strcmp("Play Back", text))
     efl_ui_animation_view_play_back((Evas_Object*)data);
   else if (!strcmp("Stop", text))
     efl_ui_animation_view_stop((Evas_Object*)data);
   else if (!strcmp("ADD", text))
     {
        Evas_Object *list = (Evas_Object*)data;
        Elm_Object_Item *list_it;
        char new_path[255], new_type[255], new_values[255];
        if (add_value_provider(new_path, new_type, new_values))
          {
             char buf[255];
             //TODO: Even if there is the same path as the existing item, it is added without updating.
             //      In efl_ui_animation_view, duplicate paths are managed.
             //      However, animator (lottie) does not have an implementation that manages overridden values.
             /*Eina_List *items = (Eina_List*)elm_list_items_get(list);
             Eina_List *l;
             EINA_LIST_FOREACH(items, l, list_it)
               {
                  char item_text[255];
                  strcpy(item_text, elm_object_item_text_get(list_it));
                  if (item_text[0] != '/')
                    {
                       char* path = strtok(item_text, "/");
                       char* type = strtok(NULL, "/");
                       if (!strcmp(new_path, path) && !strcmp(new_type, type))
                          {
                             elm_object_item_del(list_it);
                             break;
                          }
                    }
               }*/
             sprintf(buf, "%s/%s/%s", new_path, new_type, new_values);
             list_it = elm_list_item_append(list, buf, NULL, NULL, NULL, NULL);
             elm_list_item_bring_in(list_it);
             elm_list_go(list);
          }
     }
   else if (!strcmp("DEL", text))
     {
        Evas_Object *list = (Evas_Object*)data;
        Elm_Object_Item *list_it = elm_list_selected_item_get(list);
        if (list_it)
          {
             char item_text[255];
             strcpy(item_text, elm_object_item_text_get(list_it));
             if (item_text[0] != '/')
               {
                   /* Need to work */
               }
             //TODO
             printf("Value provider remove is not implemented yet\n");
             /*elm_object_item_del(list_it);
             elm_list_go(list);*/
          }
     }
}

static void
check_changed_cb(void *data, const Efl_Event *event)
{
   Evas_Object *anim_view = data;
   efl_ui_animation_view_auto_repeat_set(anim_view, efl_ui_selectable_selected_get(event->object));
}

static void
speed_changed_cb(void *data, const Efl_Event *event)
{
   Evas_Object *anim_view = data;
   double speed = 1;
   if (efl_ui_selectable_selected_get(event->object)) speed = 0.25;
   efl_ui_animation_view_speed_set(anim_view, speed);
}

static void
limit_frame_cb(void *data, const Efl_Event *event)
{
   Evas_Object *anim_view = data;
   int frame_count = efl_ui_animation_view_frame_count_get(anim_view);
   printf("Total Frame Count : %d\n", frame_count);
   if (efl_ui_selectable_selected_get(event->object))
     {
        efl_ui_animation_view_min_frame_set(anim_view, 5);
        efl_ui_animation_view_max_frame_set(anim_view, 10);
        printf("Frames to show 5-10 only\n");
     }
   else
     {
        efl_ui_animation_view_min_frame_set(anim_view, 0);
        efl_ui_animation_view_max_frame_set(anim_view, frame_count);
        printf("Showing all frames now\n");
     }
}

static void
update_anim_view_state(Evas_Object *anim_view, Evas_Object *label)
{
   Efl_Ui_Animation_View_State state = efl_ui_animation_view_state_get(anim_view);

   switch (state)
     {
      case EFL_UI_ANIMATION_VIEW_STATE_NOT_READY:
         efl_text_set(label, "State = Not Ready");
         break;
      case EFL_UI_ANIMATION_VIEW_STATE_PLAY:
         efl_text_set(label, "State = Playing");
         break;
      case EFL_UI_ANIMATION_VIEW_STATE_PLAY_BACK:
         efl_text_set(label, "State = Playing Back");
         break;
      case EFL_UI_ANIMATION_VIEW_STATE_PAUSE:
         efl_text_set(label, "State = Paused");
         break;
      case EFL_UI_ANIMATION_VIEW_STATE_STOP:
         efl_text_set(label, "State = Stopped");
         break;
     }
}

static void
_play_updated(void *data, Evas_Object *obj, void *ev EINA_UNUSED)
{
   Evas_Object *slider = data;
   efl_ui_range_value_set(slider, efl_ui_animation_view_progress_get(obj));
}

static void
_state_update(void *data, Evas_Object *obj, void *ev EINA_UNUSED)
{
   Evas_Object *label = data;
   update_anim_view_state(obj, label);
}

static void
_play_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev EINA_UNUSED)
{
   printf("done!\n");
}

static void
_play_repeated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev EINA_UNUSED)
{
   printf("repeated!\n");
}

static void
_slider_changed_cb(void *data, const Efl_Event *ev)
{
   Evas_Object *anim_view = data;
   efl_ui_animation_view_progress_set(anim_view, efl_ui_range_value_get(ev->object));
}

static void
_slider_reset(void *data, Evas_Object *obj EINA_UNUSED, void *ev EINA_UNUSED)
{
   Evas_Object *slider = data;
   efl_ui_range_value_set(slider, 0);
}

void values_input(Eo* box, const char* type)
{
   for (int i = 0; i < 4; i++)
     {
        if (values[i])
          {
             //efl_pack_unpack(box, values[i]);
             efl_del(values[i]);
             values[i] = NULL;
          }
     }
   if (strstr(type, "Color") != NULL)
     {
        char color_text[4][2] = { "R", "G", "B", "A" };
        for (int i = 0; i < 4; i++)
          {
             values[i] =  efl_add(EFL_UI_TEXTBOX_CLASS, box,
                                  efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
                                  efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
                                  efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
                                  efl_text_interactive_editable_set(efl_added, EINA_TRUE),
                                  efl_pack(box, efl_added));
             efl_gfx_hint_size_min_set(values[i], EINA_SIZE2D(50, 10));
             efl_text_set(efl_part(values[i], "efl.text_guide"), color_text[i]);
          }
     }
   else if (!strcmp(type, "StrokeWidth"))
     {
        values[0] =  efl_add(EFL_UI_TEXTBOX_CLASS, box,
                             efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
                             efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
                             efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
                             efl_text_interactive_editable_set(efl_added, EINA_TRUE),
                             efl_pack(box, efl_added));
        efl_gfx_hint_size_min_set(values[0], EINA_SIZE2D(50, 10));
        efl_text_set(efl_part(values[0], "efl.text_guide"), "Width(double type)");
     }
}

static void
_hover_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
{
   Evas_Object* box = (Evas_Object*)data;
   const char *selected = elm_object_item_text_get(event_info);

   elm_object_text_set(obj, selected);
   values_input(box, selected);
}

void
test_efl_gfx_vg_value_provider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   Eo *win, *box, *box_sub, *label, *check, *slider, *list;
   char buf[255];
   // This line must to need.
   setenv("ELM_ACCEL", "gl", 1);

   win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
                 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
                 efl_text_set(efl_added, "Efl_Ui_Animation_View demo"),
                 efl_ui_win_autodel_set(efl_added, EINA_TRUE));

   // Create a box in Canvas
   box = efl_add(EFL_UI_BOX_CLASS, win,
                 efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND),
                 efl_content_set(win, efl_added));

   //Create a label to show state of animation
   label = efl_add(EFL_UI_TEXTBOX_CLASS, win,
                   efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
                   efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
                   efl_pack(box, efl_added));

   //Create Animation View to play animation directly from JSON file
   snprintf(buf, sizeof(buf), "%s/images/three_box.json", elm_app_data_dir_get());
   anim_view = efl_add(EFL_UI_ANIMATION_VIEW_CLASS, win,
                       efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND),
                       efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
                       efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(600, 600)),
                       efl_file_set(efl_added, buf),
                       efl_pack(box, efl_added));

//-----------------------------------------------------------------------------------
   box_sub = efl_add(EFL_UI_BOX_CLASS, box,
                  efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
                  efl_pack(box, efl_added));
   //Path
   efl_add(EFL_UI_TEXTBOX_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
           efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_FALSE),
           efl_text_set(efl_added, "Path examples : three_box.json\n"
                                   "**\n"
                                   "layer.*.Fill 1\n"
                                   "layer.box1.*\n"
                                   "layer.box1.Fill 1\n"
                                   "layer.box1.Stroke 1\n"
                                   "layer.box_sub.Fill 1\n"
                                   "layer.box_sub.Stroke 1\n"
                                   "layer.box_sub.Fill 1\n"
                                   "layer.box_sub.Stroke 1\n"),
           efl_text_interactive_editable_set(efl_added, EINA_FALSE),
           efl_text_multiline_set(efl_added, EINA_TRUE),
           efl_pack(box_sub, efl_added));

   efl_add(EFL_UI_TEXTBOX_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, 0, 0),
           efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_FALSE),
           efl_text_set(efl_added, "[Value Provider]"),
           efl_text_interactive_editable_set(efl_added, EINA_FALSE),
           efl_text_multiline_set(efl_added, EINA_TRUE),
           efl_pack(box_sub, efl_added));
//-----------------------------------------------------------------------------------
   // Controller Set : 0
   box_sub = efl_add(EFL_UI_BOX_CLASS, box,
                  efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
                  efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
                  efl_pack(box, efl_added));

   //Path
   efl_add(EFL_UI_TEXTBOX_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, 0, 0),
           efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "PATH : "),
           efl_text_interactive_editable_set(efl_added, EINA_FALSE),
           efl_pack(box_sub, efl_added));

   path_entry = efl_add(EFL_UI_TEXTBOX_CLASS, box_sub,
                   efl_gfx_hint_weight_set(efl_added, 0.1, 0),
                   efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
                   efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
                   efl_text_interactive_editable_set(efl_added, EINA_TRUE),
                   efl_pack(box_sub, efl_added));
   efl_gfx_hint_size_min_set(path_entry, EINA_SIZE2D(200, 10));
   efl_text_set(efl_part(path_entry, "efl.text_guide"), "Enter path(ex: ** or Layer.Shape.Fill) ");

   efl_add(EFL_UI_TEXTBOX_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, 0, 0),
           efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "TYPE : "),
           efl_text_interactive_editable_set(efl_added, EINA_FALSE),
           efl_pack(box_sub, efl_added));
   type_hoversel = elm_hoversel_add(box_sub);
   elm_hoversel_hover_parent_set(type_hoversel, win);
   evas_object_size_hint_weight_set(type_hoversel, 0, 0);
   evas_object_size_hint_align_set(type_hoversel, EVAS_HINT_FILL, EVAS_HINT_FILL);
   efl_gfx_hint_size_min_set(type_hoversel, EINA_SIZE2D(100, 10)),
   elm_object_text_set(type_hoversel, "FillColor");
   elm_hoversel_item_add(type_hoversel, "FillColor", NULL, ELM_ICON_NONE, _hover_item_selected_cb, box_sub);
   elm_hoversel_item_add(type_hoversel, "StrokeColor", NULL, ELM_ICON_NONE, _hover_item_selected_cb, box_sub);
   elm_hoversel_item_add(type_hoversel, "StrokeWidth", NULL, ELM_ICON_NONE, _hover_item_selected_cb, box_sub);
   evas_object_show(type_hoversel);
   elm_object_focus_set(type_hoversel, EINA_TRUE);
   efl_pack(box_sub, type_hoversel);

   efl_add(EFL_UI_TEXTBOX_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, 0, 0),
           efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "VALUES : "),
           efl_text_interactive_editable_set(efl_added, EINA_FALSE),
           efl_pack(box_sub, efl_added));
   values_input(box_sub, elm_object_text_get(type_hoversel));

//-----------------------------------------------------------------------------------

   // Controller Set : 0
   box_sub = efl_add(EFL_UI_BOX_CLASS, box,
                  efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
                  efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
                  efl_pack(box, efl_added));

   list = elm_list_add(win);
   evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_show(list);
   efl_pack(box_sub, list);

   elm_object_item_disabled_set(elm_list_item_append(list, "Example : ** / FillColor / 255, 255, 255, 255", NULL, NULL, NULL, NULL), EINA_TRUE);
   efl_gfx_hint_size_min_set(list, EINA_SIZE2D(400, 100)),
   elm_list_go(list);



   efl_add(EFL_UI_BUTTON_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, 0, 0),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "ADD"),
           efl_pack(box_sub, efl_added),
           efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(50, 20)),
           efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, btn_clicked_cb, list));

   efl_add(EFL_UI_BUTTON_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, 0, 0),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "DEL"),
           efl_pack(box_sub, efl_added),
           efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(50, 20)),
           efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, btn_clicked_cb, list));
//-----------------------------------------------------------------------------------
   // Controller Set : 0
   box_sub = efl_add(EFL_UI_BOX_CLASS, box,
                  efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
                  efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
                  efl_pack(box, efl_added));

   //Loop
   check = efl_add(EFL_UI_CHECK_CLASS, box_sub,
                   efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
                   efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
                   efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
                   efl_pack(box_sub, efl_added));
   efl_text_set(check, "Loop");
   efl_event_callback_add(check, EFL_UI_EVENT_SELECTED_CHANGED,  check_changed_cb, anim_view);

   //Speed: 0.5x
   check = efl_add(EFL_UI_CHECK_CLASS, box_sub,
                   efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
                   efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
                   efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
                   efl_pack(box_sub, efl_added));
   efl_text_set(check, "Speed: 0.25x");
   efl_event_callback_add(check, EFL_UI_EVENT_SELECTED_CHANGED,  speed_changed_cb, anim_view);

   //Limit Frames
   check = efl_add(EFL_UI_CHECK_CLASS, box_sub,
                   efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
                   efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
                   efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
                   efl_pack(box_sub, efl_added));
   efl_text_set(check, "Limit Frames");
   efl_event_callback_add(check, EFL_UI_EVENT_SELECTED_CHANGED,  limit_frame_cb, anim_view);


   //Duration Text
   snprintf(buf, sizeof(buf), "Duration: %1.2fs", efl_ui_animation_view_duration_time_get(anim_view));
   efl_add(EFL_UI_TEXTBOX_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
           efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, buf),
           efl_pack(box_sub, efl_added));

   //Slider
   slider = efl_add(EFL_UI_SLIDER_CLASS, box,
                    efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
                    efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
                    efl_ui_range_limits_set(efl_added, 0, 1),
                    efl_event_callback_add(efl_added, EFL_UI_RANGE_EVENT_CHANGED, _slider_changed_cb, anim_view),
                    efl_pack(box, efl_added));

   //Controller Set: 1
   box_sub = efl_add(EFL_UI_BOX_CLASS, box,
                  efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
                  efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, 1),
                  efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
                  efl_pack(box, efl_added));

   //Play Button
   efl_add(EFL_UI_BUTTON_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "Play"),
           efl_pack(box_sub, efl_added),
           efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, btn_clicked_cb, anim_view));


   //Play Back Button
   efl_add(EFL_UI_BUTTON_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "Play Back"),
           efl_pack(box_sub, efl_added),
           efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, btn_clicked_cb, anim_view));

   //Stop Button
   efl_add(EFL_UI_BUTTON_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "Stop"),
           efl_pack(box_sub, efl_added),
           efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, btn_clicked_cb, anim_view));

   //Controller Set: 2
   box_sub = efl_add(EFL_UI_BOX_CLASS, box,
                  efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
                  efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, 1),
                  efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
                  efl_pack(box, efl_added));

   //Pause Button
   efl_add(EFL_UI_BUTTON_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "Pause"),
           efl_pack(box_sub, efl_added),
           efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, btn_clicked_cb, anim_view));

   //Resume Button
   efl_add(EFL_UI_BUTTON_CLASS, box_sub,
           efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_text_set(efl_added, "Resume"),
           efl_pack(box_sub, efl_added),
           efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, btn_clicked_cb, anim_view));

   evas_object_smart_callback_add(anim_view, "play,start", _state_update, label);
   evas_object_smart_callback_add(anim_view, "play,stop", _state_update, label);
   evas_object_smart_callback_add(anim_view, "play,pause", _state_update, label);
   evas_object_smart_callback_add(anim_view, "play,resume", _state_update, label);

   evas_object_smart_callback_add(anim_view, "play,repeat", _play_repeated, label);
   evas_object_smart_callback_add(anim_view, "play,done", _play_done, label);

   evas_object_smart_callback_add(anim_view, "play,update", _play_updated, slider);
   evas_object_smart_callback_add(anim_view, "play,stop", _slider_reset, slider);

   update_anim_view_state(anim_view, label);

   efl_gfx_entity_size_set(win, EINA_SIZE2D(600, 850));
}

#else

void
test_efl_gfx_vg_value_provider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
   Eo *win, *box;
   char buf[255];

   win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
                 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
                 efl_text_set(efl_added, "Efl_Ui_Animation_View demo"),
                 efl_ui_win_autodel_set(efl_added, EINA_TRUE));

   // Create a box
   box = efl_add(EFL_UI_BOX_CLASS, win,
                 efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND),
                 efl_content_set(win, efl_added));

   efl_add(EFL_UI_TEXTBOX_CLASS, win,
           efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
           efl_gfx_hint_fill_set(efl_added, EINA_FALSE, EINA_FALSE),
           efl_text_set(efl_added, "Evas Vg Json (Lottie) Loader is not supported, Only Static Vector Image is available!"),
           efl_pack(box, efl_added));

   //Create Vector object.
   snprintf(buf, sizeof(buf), "%s/images/tiger.svg", elm_app_data_dir_get());
   efl_add(EFL_CANVAS_VG_OBJECT_CLASS, win,
           efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND),
           efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL),
           efl_gfx_entity_size_set(efl_added, EINA_SIZE2D(600, 600)),
           efl_file_simple_load(efl_added, buf, NULL),
           efl_gfx_entity_visible_set(efl_added, EINA_TRUE),
           efl_pack(box, efl_added));

   efl_gfx_entity_size_set(win, EINA_SIZE2D(600, 730));
}

#endif