Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/bin


Modified Files:
      Tag: SPLIT
        ecore_evas_test_bg.c 


Log Message:


demo is looking a litle nicer... :)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/bin/Attic/ecore_evas_test_bg.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- ecore_evas_test_bg.c        22 Feb 2003 10:34:06 -0000      1.1.2.5
+++ ecore_evas_test_bg.c        23 Feb 2003 02:00:54 -0000      1.1.2.6
@@ -6,9 +6,16 @@
 Evas_Object *o_logo     = NULL;
 Ecore_Timer *anim_timer = NULL;
 
-#define NUM 24
+#define NUM 32
 
-Evas_Object *o_fly[NUM];
+Evas_Object *o_ball[NUM];
+Evas_Object *o_shad[NUM];
+
+Evas_Object *o_clip = NULL;
+Evas_Object *o_bar[2];
+Evas_Object *o_bar_shad_1[3];
+Evas_Object *o_bar_shad_2[2];
+Evas_Object *o_bg = NULL;
 
 static int bg_animate_obj_timer(void *data);
 static void bg_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
@@ -17,6 +24,8 @@
 bg_resize(double w, double h)
 {
    evas_object_resize(o_bg_rect, w, h);
+   evas_object_move(o_logo, (w - 240) / 2, (h - 280) / 2);
+   bg_animate_obj_timer(NULL);
 }
 
 void
@@ -40,24 +49,117 @@
    evas_object_resize(o, 240, 280);
    evas_object_image_fill_set(o, 0, 0, 240, 280);
    evas_object_move(o, (240 - 240) / 2, (320 - 280) / 2);
+   evas_object_layer_set(o, -999);
+   evas_object_pass_events_set(o, 1);
    evas_object_show(o);
    o_logo = o;
    
+   o = evas_object_rectangle_add(evas);
+   evas_object_color_set(o, 255, 255, 255, 255);
+   evas_object_resize(o, 240, 0);
+   evas_object_pass_events_set(o, 1);
+   evas_object_show(o);
+   o_clip = o;
+
+   o = evas_object_image_add(evas);
+   evas_object_image_file_set(o, IM"bg.png", NULL);
+   evas_object_resize(o, 240, 320);
+   evas_object_image_fill_set(o, 0, 0, 240, 320);
+   evas_object_layer_set(o, -9999);
+   evas_object_move(o, 0, 0);
+   evas_object_clip_set(o, o_clip);
+   evas_object_pass_events_set(o, 1);
+   evas_object_show(o);
+   o_bg = o;
+   
+   o = evas_object_image_add(evas);
+   evas_object_image_file_set(o, IM"bar.png", NULL);
+   evas_object_image_border_set(o, 5, 5, 5, 5);
+   evas_object_resize(o, 240, 32);
+   evas_object_image_fill_set(o, 0, 0, 240, 32);
+   evas_object_layer_set(o, 100);
+   evas_object_pass_events_set(o, 1);
+   o_bar[0] = o;
+
+   o = evas_object_image_add(evas);
+   evas_object_image_file_set(o, IM"bar.png", NULL);
+   evas_object_image_border_set(o, 5, 5, 5, 5);
+   evas_object_resize(o, 240, 32);
+   evas_object_image_fill_set(o, 0, 0, 240, 32);
+   evas_object_layer_set(o, 100);
+   evas_object_pass_events_set(o, 1);
+   o_bar[1] = o;
+   
+   o = evas_object_image_add(evas);
+   evas_object_image_file_set(o, IM"bar_shad_above.png", NULL);
+   evas_object_resize(o, 240, 8);
+   evas_object_image_fill_set(o, 0, 0, 240, 8);
+   evas_object_image_smooth_scale_set(o, 0);
+   evas_object_layer_set(o, 100);
+   evas_object_pass_events_set(o, 1);
+   o_bar_shad_1[0] = o;
+
+   o = evas_object_image_add(evas);
+   evas_object_image_file_set(o, IM"bar_shad_below.png", NULL);
+   evas_object_resize(o, 240, 32);
+   evas_object_image_fill_set(o, 0, 0, 240, 32);
+   evas_object_image_smooth_scale_set(o, 0);
+   evas_object_layer_set(o, -100);
+   evas_object_pass_events_set(o, 1);
+   evas_object_clip_set(o, o_clip);
+   o_bar_shad_1[1] = o;
+
+   o = evas_object_image_add(evas);
+   evas_object_image_file_set(o, IM"bar_shad_below.png", NULL);
+   evas_object_resize(o, 240, 16);
+   evas_object_image_fill_set(o, 0, 0, 240, 16);
+   evas_object_image_smooth_scale_set(o, 0);
+   evas_object_layer_set(o, 100);
+   evas_object_pass_events_set(o, 1);
+   evas_object_clip_set(o, o_clip);
+   o_bar_shad_1[2] = o;
+   
+   o = evas_object_image_add(evas);
+   evas_object_image_file_set(o, IM"bar_shad_above.png", NULL);
+   evas_object_resize(o, 240, 8);
+   evas_object_image_fill_set(o, 0, 0, 240, 8);
+   evas_object_image_smooth_scale_set(o, 0);
+   evas_object_layer_set(o, 100);
+   evas_object_pass_events_set(o, 1);
+   evas_object_clip_set(o, o_clip);
+   o_bar_shad_2[0] = o;
+   
+   o = evas_object_image_add(evas);
+   evas_object_image_file_set(o, IM"bar_shad_below.png", NULL);
+   evas_object_resize(o, 240, 8);
+   evas_object_image_fill_set(o, 0, 0, 240, 8);
+   evas_object_image_smooth_scale_set(o, 0);
+   evas_object_layer_set(o, 100);
+   evas_object_pass_events_set(o, 1);
+   o_bar_shad_2[1] = o;
+   
      {
        int i;
        
        for (i = 0; i < NUM; i++)
          {
-            o = evas_object_rectangle_add(evas);
-            evas_object_move(o, 10, 10);
+            o = evas_object_image_add(evas);
+            evas_object_image_file_set(o, IM"ball.png", NULL);
+            evas_object_resize(o, 32, 32);
+            evas_object_image_fill_set(o, 0, 0, 32, 32);
+            evas_object_move(o, 0, 0);
+            evas_object_pass_events_set(o, 1);
+            evas_object_clip_set(o, o_clip);
+            o_ball[i] = o;
+            o = evas_object_image_add(evas);
+            evas_object_image_file_set(o, IM"shadow.png", NULL);
+            evas_object_resize(o, 32, 32);
+            evas_object_image_fill_set(o, 0, 0, 32, 32);
+            evas_object_move(o, 0, 0);
             evas_object_pass_events_set(o, 1);
-            evas_object_color_set(o,
-                                  (rand()) & 0xff,
-                                  (rand() / 30) & 0xff,
-                                  (rand() / 65) & 0xff,
-                                  (rand() / 156) & 0xff);
-            evas_object_resize(o, 4 + ((rand()) % 100), 4 + ((rand() / 50) % 100));
-            o_fly[i] = o;
+            evas_object_clip_set(o, o_clip);
+            evas_object_lower(o);
+            o_shad[i] = o;
          }
      }
 }
@@ -66,32 +168,103 @@
 bg_go(void)
 {
    /* add a timer to animate them */
-   anim_timer = ecore_timer_add(0.05, bg_animate_obj_timer, NULL);
+   anim_timer = ecore_timer_add(0.01, bg_animate_obj_timer, NULL);
 }
 
 static int
 bg_animate_obj_timer(void *data)
 {
    Evas_Object *o;
-   double x, y;
+   double x, y, sx, sy, v;
    double w, h;
-   double ow, oh;
+   int ow, oh;
    double t;
-   int m, n;
+   int l, m, n;
    int i;
+   static double t_first = 0;
+   static int done = 0;
    
    t = ecore_time_get() - start_time;
+   if (t_first == 0) t_first = t;
+   if (t - t_first > 2.0) done = 1;
+   evas_output_viewport_get(evas_object_evas_get(o_clip), NULL, NULL, &w, &h);
+   if (!done)
+     {
+       v = ((cos(((t - t_first) / 2) * 3.14159) - 1.0) / -2);
+       l = (80) * v;
+     }
+   else
+     {
+       l = 80;
+     }
+   evas_object_move(o_bar[0], 0, (h / 2) - 32 - l);
+   evas_object_move(o_bar[1], 0, (h / 2) + l);
+   evas_object_move(o_bar_shad_1[0], 0, (h / 2) - 32 - l - 8);
+   evas_object_move(o_bar_shad_1[1], 0, (h / 2) - l);
+   evas_object_move(o_bar_shad_1[2], 0, (h / 2) - l);
+   evas_object_move(o_bar_shad_2[0], 0, (h / 2) + l - 8);
+   evas_object_move(o_bar_shad_2[1], 0, (h / 2) + 32 + l);
+
+   evas_object_resize(o_bar[0], w, 32);
+   evas_object_image_fill_set(o_bar[0], 0, 0, w, 32);
+
+   evas_object_resize(o_bar[1], w, 32);
+   evas_object_image_fill_set(o_bar[1], 0, 0, w, 32);
+   
+   evas_object_resize(o_bar_shad_1[0], w, 8);
+   evas_object_image_fill_set(o_bar_shad_1[0], 0, 0, w, 8);
+
+   evas_object_resize(o_bar_shad_1[1], w, 32);
+   evas_object_image_fill_set(o_bar_shad_1[1], 0, 0, w, 32);
+
+   evas_object_resize(o_bar_shad_1[2], w, 16);
+   evas_object_image_fill_set(o_bar_shad_1[2], 0, 0, w, 16);
+
+   evas_object_resize(o_bar_shad_2[0], w, 8);
+   evas_object_image_fill_set(o_bar_shad_2[0], 0, 0, w, 8);
+   
+   evas_object_resize(o_bar_shad_2[1], w, 8);
+   evas_object_image_fill_set(o_bar_shad_2[1], 0, 0, w, 8);
+   
+   evas_object_move(o_clip, 0, (h / 2) - l);
+   evas_object_resize(o_clip, w, l * 2);
+   
+   evas_object_resize(o_bg, w, h);
+   evas_object_image_fill_set(o_bg, 0, 0, w, h);
+   
+   evas_object_show(o_bar[0]);
+   evas_object_show(o_bar[1]);
+   evas_object_show(o_bar_shad_1[0]);
+   evas_object_show(o_bar_shad_1[1]);
+   evas_object_show(o_bar_shad_1[2]);
+   evas_object_show(o_bar_shad_2[0]);
+   evas_object_show(o_bar_shad_2[1]);
    for (i = 0; i < NUM; i++)
      {
-       o = o_fly[i];
+       o = o_ball[i];
        evas_output_viewport_get(evas_object_evas_get(o), NULL, NULL, &w, &h);
-       evas_object_geometry_get(o, NULL, NULL, &ow, &oh);
-       m = ((int)o / 36) & 0x0f;
-       n = ((int)o / 763) & 0x0f;
+       l = ((int)o / 179) & 0x0f;
+       v = (sin(t * (double)l / 12) + 1.0) / 2;
+       v = 0.25 + (0.75 * v);
+       m = 1 + (((int)o / 36) & 0x0f);
+       n = 1 + (((int)o / 763) & 0x0f);
+       ow = 32 * v;
+       oh = 32 * v;
+       evas_object_resize(o, ow, oh);
+       evas_object_image_fill_set(o, 0, 0, ow, oh);
        x = sin(t * (double)m / 12) * ((w - ow) / 2);
        y = sin(t * (double)n / 12) * ((h - oh) / 2);
        evas_object_move(o, (w / 2) - (ow / 2) + x, (h / 2) - (oh / 2) + y);
        evas_object_show(o);
+       o = o_shad[i];
+       evas_object_resize(o, ow, oh);
+       evas_object_image_fill_set(o, 0, 0, ow, oh);
+       sx = v * (((w - ow) / 2)  + x) / 8;
+       sy = v * (((h - oh) / 2)  + y) / 8;
+       evas_object_move(o,
+                        (w / 2) - (ow / 2) + x + sx, 
+                        (h / 2) - (oh / 2) + y + sy);
+       evas_object_show(o);    
      }
    return 1;
 }




-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to