#define WIDTH 400
#define HEIGHT 600
+#define AUTOPLAY 1
+Eo *anim;
static Eo *gvg[5];
static void
}
static void
+_step_frame(int index, int step)
+{
+ int frame_count = efl_gfx_frame_controller_frame_count_get(gvg[index]);
+ int frame = (efl_gfx_frame_controller_frame_get(gvg[index]) + step) % frame_count;
+ efl_gfx_frame_controller_frame_set(gvg[index], frame);
+}
+
+static void
+_on_keydown(void *data EINA_UNUSED,
+ Evas *evas EINA_UNUSED,
+ Evas_Object *o EINA_UNUSED,
+ void *einfo)
+{
+ Evas_Event_Key_Down *ev = einfo;
+
+ if (strcmp(ev->key, "space") == 0) {
+ double animation_progress = efl_canvas_object_animation_progress_get(gvg[0]);
+ if (animation_progress < 0)
+ {
+ printf("Animation started\n");
+ efl_canvas_object_animation_start(gvg[0], anim, 1.0, 0.0);
+ }
+ else
+ {
+ printf("Animation stopped\n");
+ efl_canvas_object_animation_stop(gvg[0]);
+ }
+ }
+
+ if (strcmp(ev->key, "Right") == 0)
+ {
+ printf("Moved first image single frame forward\n");
+ _step_frame(0, 1);
+ }
+
+ if (strcmp(ev->key, "Left") == 0)
+ {
+ printf("Moved first image single frame backward\n");
+ _step_frame(0, -1);
+ }
+}
+
+static void
_on_delete(Ecore_Evas *ee EINA_UNUSED)
{
ecore_main_loop_quit();
}
+static void
+_print_help()
+{
+ printf("Space - play / stop animation on every image\n");
+ printf("Left - move first image single frame backward\n");
+ printf("Right - move first image single frame forward\n");
+}
+
int
main(void)
{
efl_gfx_entity_size_set(bg, EINA_SIZE2D(WIDTH, HEIGHT));
efl_gfx_color_set(bg, 255, 255, 255, 255);
efl_gfx_entity_visible_set(bg, EINA_TRUE);
+ evas_object_focus_set(bg, EINA_TRUE);
+ evas_object_event_callback_add(bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL);
char buf[PATH_MAX];
efl_gfx_entity_visible_set(vg5, EINA_TRUE);
//Play custom animation
- Eo *anim = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas);
+ anim = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas);
efl_animation_duration_set(anim, efl_gfx_frame_controller_frame_duration_get(vg, 0, 0));
efl_event_callback_add(vg, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _running_cb, NULL);
- efl_canvas_object_animation_start(vg, anim, 1.0, 0.0);
+#ifdef AUTOPLAY
+ efl_canvas_object_animation_start(gvg[0], anim, 1.0, 0.0);
+#endif // AUTOPLAY
+
+ _print_help();
ecore_main_loop_begin();
ecore_evas_shutdown();