tuned animation for demo
[livewp] / applet / src / livewp-home-widget.c
index 5eb2ac7..6094679 100644 (file)
@@ -208,9 +208,12 @@ init_object(AWallpaperPlugin *desktop_plugin,
   actor->name = g_strdup(name);
   actor->func_change = (gpointer)pfunc_change; 
   actor->func_probability = (gpointer)pfunc_probability;
-  if (visible)
+  if (visible){
     create_hildon_actor(actor, desktop_plugin);
-  else 
+    if (!strcmp(actor->name, "window") || !strcmp(actor->name, "moon")){
+       hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(actor->widget), FALSE);
+    }  
+  }else 
     actor->widget = NULL;
   actor->time_start_animation = 0;
   actor->duration_animation = 0;
@@ -273,8 +276,9 @@ fprintf(stderr, "change moon\n");
                     g_free(actor->filename);
                 actor->filename = newfile;
 #endif
-                create_hildon_actor(actor, desktop_plugin);
+                //create_hildon_actor(actor, desktop_plugin);
 
+               hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(actor->widget), actor->visible);
             }
             //actor->x = 400;
             //actor->y = 10;
@@ -283,8 +287,9 @@ fprintf(stderr, "change moon\n");
             //fprintf(stderr, "after change sun %d\n", actor->time_start_animation);
          }else if (actor->visible){
             actor->visible = FALSE;
-            fprintf(stderr, "destroy moon \n");
-            destroy_hildon_actor(actor);
+            //fprintf(stderr, "destroy moon \n");
+            //destroy_hildon_actor(actor);
+           hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(actor->widget), actor->visible);
             /* TO DO make moonrise*/
             actor->time_start_animation = 0;
         } 
@@ -595,7 +600,8 @@ change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
     if (scene.daytime == TIME_DAY){
         if (actor->visible){
             actor->visible = FALSE;
-            destroy_hildon_actor(actor);
+            //destroy_hildon_actor(actor);
+           hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(actor->widget), actor->visible);
         }
         actor->time_start_animation = 0;
         return;
@@ -606,11 +612,13 @@ change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
 
     if (!actor->visible){
         actor->visible = TRUE;
-        create_hildon_actor(actor, desktop_plugin);
+        //create_hildon_actor(actor, desktop_plugin);
+       hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(actor->widget), actor->visible);
         actor->time_start_animation = now + 5;
     }else {
         actor->visible = FALSE;
-        destroy_hildon_actor(actor);
+        //destroy_hildon_actor(actor);
+       hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(actor->widget), actor->visible);
         actor->time_start_animation = now + 5;
     }
    
@@ -835,7 +843,7 @@ init_scene(AWallpaperPlugin *desktop_plugin)
   actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, 0, 7, 150, 97, 
                       FALSE, 100, 255, (gpointer)&change_cloud, NULL);
   actor->time_start_animation = now;
-  actor->duration_animation = 1*60;
+  actor->duration_animation = 40;
   scene.actors = g_slist_append(scene.actors, actor);
   
   actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, 80, 7, 188, 75, 
@@ -847,7 +855,7 @@ init_scene(AWallpaperPlugin *desktop_plugin)
   actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, 30, 7, 150, 75, 
                       FALSE, 100, 255, (gpointer)&change_cloud, NULL);
   actor->time_start_animation = now + 40;
-  actor->duration_animation = 1*60;
+  actor->duration_animation = 50;
   scene.actors = g_slist_append(scene.actors, actor);
 
 
@@ -859,7 +867,7 @@ init_scene(AWallpaperPlugin *desktop_plugin)
   actor = init_object(desktop_plugin, "tram", "tram.png", -300, 225, 9, 350, 210, 
                       FALSE, 100, 255, (gpointer)&change_tram, NULL);
   actor->time_start_animation = now; 
-  actor->duration_animation = 40;
+  actor->duration_animation = 32;
   scene.actors = g_slist_append(scene.actors, actor);
 
   actor = init_object(desktop_plugin, "border", "border0.png", 0, 480-79, 10, 800, 79,
@@ -868,7 +876,7 @@ init_scene(AWallpaperPlugin *desktop_plugin)
   scene.actors = g_slist_append(scene.actors, actor);
   
   actor = init_object(desktop_plugin, "moon", "moon5.png", 400, 20, 6, 60, 60, 
-                      FALSE, 100, 255, (gpointer)&change_moon, NULL);
+                      TRUE, 100, 255, (gpointer)&change_moon, NULL);
   change_moon(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 /*
@@ -908,19 +916,10 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     
     winds[9][0] = 495;
     winds[9][1] = 241;
-    
-    winds[10][0] = 495;
-    winds[10][1] = 252;
-    
-    winds[11][0] = 482;
-    winds[11][1] = 273;
-    
-    winds[12][0] = 495;
-    winds[12][1] = 303;
-    for (i=0; i<13; i++){
-        actor = init_object(desktop_plugin, "window1", "window1.png", 
+    for (i=0; i<10; i++){
+        actor = init_object(desktop_plugin, "window", "window1.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            TRUE, 100, 255, (gpointer)&change_window1, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -946,16 +945,10 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     
     winds[5][0] = 94;
     winds[5][1] = 243;
-    
-    winds[6][0] = 94;
-    winds[6][1] = 265;
-    
-    winds[7][0] = 94;
-    winds[7][1] = 331;
-    for (i=0; i<8; i++){
-        actor = init_object(desktop_plugin, "window2", "window2.png", 
+    for (i=0; i<6; i++){
+        actor = init_object(desktop_plugin, "window", "window2.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            TRUE, 100, 255, (gpointer)&change_window1, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -987,17 +980,11 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     
     winds[7][0] = 322;
     winds[7][1] = 224;
-    
-    winds[8][0] = 323;
-    winds[8][1] = 217;
-    
-    winds[9][0] = 322;
-    winds[9][1] = 288;
-    
-    for (i=0; i<10; i++){
-        actor = init_object(desktop_plugin, "window3", "window3.png", 
+   
+    for (i=0; i<8; i++){
+        actor = init_object(desktop_plugin, "window", "window3.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            TRUE, 100, 255, (gpointer)&change_window1, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -1020,17 +1007,11 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     
     winds[4][0] = 610;
     winds[4][1] = 320;
-    
-    winds[5][0] = 593;
-    winds[5][1] = 352;
-    
-    winds[6][0] = 610;
-    winds[6][1] = 368;
-    
-    for (i=0; i<7; i++){
-        actor = init_object(desktop_plugin, "window4", "window4.png", 
+   
+    for (i=0; i<5; i++){
+        actor = init_object(desktop_plugin, "window", "window4.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            TRUE, 100, 255, (gpointer)&change_window1, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -1051,16 +1032,10 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     winds[3][0] = 717;
     winds[3][1] = 323;
     
-    winds[4][0] = 698;
-    winds[4][1] = 362;
-    
-    winds[5][0] = 698;
-    winds[5][1] = 400;
-    
-    for (i=0; i<6; i++){
-        actor = init_object(desktop_plugin, "window5", "window5.png", 
+    for (i=0; i<4; i++){
+        actor = init_object(desktop_plugin, "window", "window5.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            TRUE, 100, 255, (gpointer)&change_window1, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);
@@ -1118,7 +1093,7 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
 #endif
 
   actor = init_object(desktop_plugin, "moon", "moon4.png", 400, 15, 6, 60, 60, 
-                      FALSE, 100, 255, (gpointer)&change_moon, NULL);
+                      TRUE, 100, 255, (gpointer)&change_moon, NULL);
   change_moon(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
   
@@ -1166,7 +1141,7 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
   actor = init_object(desktop_plugin, "signal", "red.png", 486, 425, 10, 18, 38, 
                       TRUE, 100, 255, (gpointer)&change_signal, NULL);
   actor->time_start_animation = now;  
-  scene.actors = g_slist_append(scene.actors, actor);winds[0][0] = 717;
+  scene.actors = g_slist_append(scene.actors, actor);
     
     winds[0][0] = 389;
     winds[0][1] = 305;
@@ -1210,7 +1185,7 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
     for (i=0; i<13; i++){
         actor = init_object(desktop_plugin, "window", "window.png", 
                             winds[i][0], winds[i][1], 10, 8, 9, 
-                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+                            TRUE, 100, 255, (gpointer)&change_window1, NULL);
         //change_window1(actor, desktop_plugin);
         actor->time_start_animation = now + fast_rnd(30);
         scene.actors = g_slist_append(scene.actors, actor);