/* loop - do things */
static void _loop(double t, int f)
{
   int i;
   static Evas_Map *m = NULL;
   Evas_Coord x, y, w, h;
   if (!m) m = evas_map_new(4);
   evas_map_smooth_set(m, 0);
   for (i = 0; i < (OBNUM / 2); i++)
     {
        w = 120;
	h = 160;
	x = (win_w / 2) - (w / 2);
        x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
	y = (win_h / 2) - (h / 2);
        y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);

	evas_map_util_points_populate_from_geometry(m, x, y, w, h, 0);

        evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2));

        evas_object_map_enable_set(o_images[i], 1);
        evas_object_map_set(o_images[i], m);
     }
   FPS_STD(NAME);
}
Example #2
0
static Eina_Bool
_anim_cb(void *data)
{
   App_Data *ad = data;
   Evas_Map *m;
   Evas_Object *o;
   int r, g, b, a;
   int win_w, win_h, img_w, img_h;
   Evas_Coord x, y, w, h;

   evas_output_size_get(ad->canvas, &win_w, &win_h);

   m = evas_map_new(4);
   evas_map_smooth_set(m, ad->smooth);
   evas_map_alpha_set(m, ad->alpha);

   r = ad->colors[ad->colors_index].r;
   g = ad->colors[ad->colors_index].g;
   b = ad->colors[ad->colors_index].b;
   a = ad->colors[ad->colors_index].a;
   evas_map_util_points_color_set(m, r, g, b, a);

   o = evas_object_name_find(ad->canvas, "obj1");
   evas_object_geometry_get(o, &x, &y, &w, &h);

   evas_map_util_points_populate_from_object(m, o);
   evas_map_util_rotate(m, 3 * ad->frame, x + (w / 2), y + (h / 2));
   evas_object_map_set(o, m);
   evas_object_map_enable_set(o, EINA_TRUE);

   o = evas_object_name_find(ad->canvas, "obj2");
   evas_object_geometry_get(o, &x, &y, &w, &h);
   evas_object_image_size_get(o, &img_w, &img_h);

   evas_map_util_points_populate_from_object_full(m, o, 100);
   evas_map_point_image_uv_set(m, 0, 0, 0);
   evas_map_point_image_uv_set(m, 1, img_w, 0);
   evas_map_point_image_uv_set(m, 2, img_w, img_h);
   evas_map_point_image_uv_set(m, 3, 0, img_h);
   evas_map_util_3d_rotate(m, ad->frame * 6, ad->frame * 6, ad->frame * 6,
                           x + (w / 3), y + 10, 0);
   if (ad->apply_lighting)
     evas_map_util_3d_lighting(m, win_w / 2, win_h / 2, -100,
                               255, 255, 255, 0, 0, 0);
   evas_object_map_set(o, m);
   evas_object_map_enable_set(o, EINA_TRUE);

   o = evas_object_name_find(ad->canvas, "obj3");
   evas_object_geometry_get(o, &x, &y, &w, &h);
   evas_object_image_size_get(o, &img_w, &img_h);

   evas_map_util_points_populate_from_geometry(m, x, y + (h / 2), w, h, -20);
   evas_map_point_image_uv_set(m, 0, 0, 0);
   evas_map_point_image_uv_set(m, 1, img_w, 0);
   evas_map_point_image_uv_set(m, 2, img_w, img_h);
   evas_map_point_image_uv_set(m, 3, 0, img_h);
   evas_map_util_3d_rotate(m, 20, ad->frame * 6, 0,
                           x + (w / 2), y + (w / 2), w / 2);

   if (ad->apply_perspective)
     evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 256);
   if (ad->apply_lighting)
     {
        Evas_Coord mx, my;
        evas_pointer_canvas_xy_get(ad->canvas, &mx, &my);
        evas_map_util_3d_lighting(m, mx, my, -256,
                                  255, 255, 255, 0, 0, 0);
     }
   if (ad->backface_culling)
     {
        if (evas_map_util_clockwise_get(m))
          evas_object_show(o);
        else
          evas_object_hide(o);
     }
   else
     evas_object_show(o);
   evas_object_map_set(o, m);
   evas_object_map_enable_set(o, EINA_TRUE);

   evas_map_free(m);

   o = evas_object_name_find(ad->canvas, "obj4");
   evas_object_geometry_get(o, &x, &y, &w, &h);
   evas_object_image_size_get(o, &img_w, &img_h);

   m = evas_map_new(4);
   evas_map_point_coord_set(m, 0, x, y + h, 0);
   evas_map_point_coord_set(m, 1, x + w, y + h, 0);
   evas_map_point_coord_set(m, 2, win_w - 10, win_h - 30, 0);
   evas_map_point_coord_set(m, 3, (win_w / 2) + 10, win_h - 30, 0);
   evas_map_point_image_uv_set(m, 0, 0, img_h);
   evas_map_point_image_uv_set(m, 1, img_w, img_h);
   evas_map_point_image_uv_set(m, 2, img_w, 2 * (img_h / 3));
   evas_map_point_image_uv_set(m, 3, 0, 2 * (img_h / 3));
   evas_map_point_color_set(m, 0, 200, 200, 200, 150);
   evas_map_point_color_set(m, 1, 200, 200, 200, 150);
   evas_map_point_color_set(m, 2, 0, 0, 0, 0);
   evas_map_point_color_set(m, 3, 0, 0, 0, 0);
   evas_object_map_set(o, m);
   evas_object_map_enable_set(o, EINA_TRUE);

   evas_map_free(m);

   ad->frame = (ad->frame + 1) % 60;

   return EINA_TRUE;
}