}
//fprintf(stderr, "change obj %i %i %i angle rad=%f, deg=%f\n", ax, ay, az, atan2(ax, -ay), atan2(ax, -ay)*180/M_PI);
- angle = atan2(ay, ax);
+ int ang = (int)floor(atan2(ay, ax)*180/M_PI);
+ if (ang < 0) ang = 360+ang;
if (!desktop_plugin->priv->rich_animation) return;
- for (i=0; i<24; i++){
+ for (i=0; i<16; i++){
a = g_ptr_array_index(actor->child, i);
- //x = a->x - cos(angle*M_PI/180)*a->z;
- //y = a->y - sin(angle*M_PI/180)*a->z;
- x = a->x - cos(angle)*a->z;
- y = a->y - sin(angle)*a->z;
- if (x <= -a->width)
- x = 800;
- if (y <= -a->width)
- y = 480;
- if (x > 800+a->width)
+ if (a->scale == 100) a->scale = ang;
+ if (abs(a->scale - ang) > 10){
+ if (a->scale > ang)
+ if ((a->scale - ang) < (ang + (360-a->scale))) a->scale--;
+ else a->scale++;
+ if (a->scale < ang)
+ if (ang - a->scale < (a->scale+(360-ang))) a->scale++;
+ else a->scale--;
+ if (a->scale > 360) a->scale = 0;
+ if (a->scale < 0) a->scale = 360;
+ }
+
+ x = round(a->x - (float)cos(a->scale*M_PI/180)*a->z);
+ y = round(a->y - (float)sin(a->scale*M_PI/180)*a->z);
+ //x = a->x - cos(angle)*a->z;
+ //y = a->y - sin(angle)*a->z;
+ if ((a->scale > 270 || a->scale < 90) && x < -a->width*cos(a->scale*M_PI/180)){
+ x = 800;
+ y = fast_rnd(480);
+ }
+ if ((a->scale > 90 && a->scale < 270) && x > 800 - a->width*cos(a->scale*M_PI/180)){
x = 0;
- if (y > 480+a->width)
+ y = fast_rnd(480);
+ }
+ if (a->scale > 0 && a->scale < 180 && y < -a->width*sin(a->scale*M_PI/180)){
+ y = 480;
+ x = fast_rnd(800);
+ }
+ if (a->scale < 360 && a->scale > 180 && y > 480 - a->width*sin(a->scale*M_PI/180)){
y = 0;
- set_actor_rotation(a, HILDON_AA_Z_AXIS, angle*180/M_PI, 0, 0, 0);
+ x = fast_rnd(800);
+ }
+ //if (i ==0) fprintf(stderr, "x=%d y=%d ang=%d speed=%d\n", x, y, a->scale, a->z);
+ set_actor_rotation(a, HILDON_AA_Z_AXIS, a->scale, 0, 0, 0);
set_actor_position(a, x, y, a->z, desktop_plugin);
a->x = x;
a->y = y;
gint now = time(NULL);
gchar *str;
gint sizes[4] = {170, 229, 130, 150},
+ sizes1[4] = {57, 76, 43, 50},
heights[4] = {0, 100, 200, 300},
n, i, j;
desktop_plugin->priv->scene = scene;
actor = init_object(desktop_plugin, "background", "bg.png",
- 0, 0, 5, 800, 480,
+ 0, 0, 0, 800, 480,
TRUE, TRUE, 100, 255,
NULL, NULL, NULL);
scene->actors = g_slist_append(scene->actors, actor);
- child = g_ptr_array_sized_new(24);
+ child = g_ptr_array_sized_new(16);
- for (j= 0; j<2; j++){
+ for (j= 0; j<4; j++){
for (n=0; n<4; n++){
- for (i=0; i<3; i++){
- str = g_strdup_printf("tape%i_%i.png", n+1, i);
+ //for (i=0; i<3; i++){
+ str = g_strdup_printf("tape%i.png", n+1);
actor = init_object(desktop_plugin, "tape", str,
- fast_rnd(700), fast_rnd(430), 1+fast_rnd(10), 800, sizes[n],
+ fast_rnd(800), fast_rnd(480), 2+fast_rnd(6), 800, sizes1[n],
TRUE, TRUE, 100, 255,
NULL, NULL, NULL);
scene->actors = g_slist_append(scene->actors, actor);
g_ptr_array_add(child, actor);
g_free(str);
- }
+ //}
}
}
actor = init_object(desktop_plugin, "tape", "",