done fifteen
authortanya <tanya@moshkanov.oblgaz>
Wed, 1 Sep 2010 19:20:10 +0000 (22:20 +0300)
committertanya <tanya@moshkanov.oblgaz>
Wed, 1 Sep 2010 19:20:10 +0000 (22:20 +0300)
applet/src/fifteen.c

index b3d9d4d..b9b1994 100644 (file)
@@ -95,8 +95,10 @@ void moving_actor(gint num, gint max, AWallpaperPlugin *desktop_plugin)
     gint x0 = actor->x, y0 = actor->y,
          x1 = (scene->empty%4)*width, y1 = (scene->empty/4)*height,
          x,y;
-    x = x0 + (x1-x0)*(max - num)/max;
-    y = y0 + (y1-y0)*(max - num)/max;
+    //x = x0 + (x1-x0)*(max - num)/max;
+    //y = y0 + (y1-y0)*(max - num)/max;
+    x = x0 + (x1-x0)*(max-num)*(max-num)/(max*max);
+    y = y0 + (y1-y0)*(max-num)*(max-num)/(max*max);
     set_actor_position(actor, x, y, actor->z, desktop_plugin);
     if (num == 0){
         actor->x = x;
@@ -108,9 +110,16 @@ void moving_actor(gint num, gint max, AWallpaperPlugin *desktop_plugin)
 }
 void moving_all(gint num, gint max, AWallpaperPlugin *desktop_plugin)
 {
-    gint i;
-
+    gint i, axis;
+    double angle;
+    angle = 360*(max - num)/max;
     for (i=0; i<15; i++){
+        if (i%2 == 0) axis = HILDON_AA_Y_AXIS;
+        else axis = HILDON_AA_X_AXIS;
+        set_actor_rotation(actors[i], axis, angle, 0, 0, 0);
+    }
+    if (num == (int)max/2){
+        reinit(desktop_plugin);
     }
 }
 gboolean main_timer(AWallpaperPlugin *desktop_plugin)
@@ -119,10 +128,12 @@ gboolean main_timer(AWallpaperPlugin *desktop_plugin)
         scene->timer_num--;
         if (scene->bone>-1)
             moving_actor(scene->timer_num, 10, desktop_plugin);
+        else 
+            moving_all(scene->timer_num, 20, desktop_plugin);
         return;
     } 
-    char * accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord";
-    //char * accel_filename = "/home/tanya/coord";
+    //char * accel_filename = "/sys/class/i2c-adapter/i2c-3/3-001d/coord";
+    char * accel_filename = "/home/tanya/coord";
 
     gint direction = -1, bone;
     FILE *fd = NULL;
@@ -141,9 +152,9 @@ gboolean main_timer(AWallpaperPlugin *desktop_plugin)
 
     //fprintf(stderr, "change obj %i %i %i\n", ax, ay, az);
     if (az < -2000) {
-        reinit(desktop_plugin);
+        //reinit(desktop_plugin);
         //sleep(1);
-        scene->timer_num = 10;
+        scene->timer_num = 20;
         scene->bone = -1;
         return TRUE;
     }