2012-11-29 33 views
1

我一直在玩Clutter,使用this tutorial作爲參考,並試圖爲三組動畫製作動畫,每組包含一個彩色矩形。我正在嘗試使用教程中使用的clutter_actor_animate方法。如果我只有三個動畫中的一個動起來,它就會起作用;不過,如果我嘗試對兩個或更多組進行動畫製作,則第一個動畫似乎適用於所有動畫。爲什麼是這樣?這裏是我的代碼的相關部分:clutter_actor_animate爲什麼會影響錯誤的參與者?

clutter_actor_animate (group_red, CLUTTER_EASE_OUT_SINE, 500, "x", 0-width, "y", 0, NULL); 
clutter_actor_animate (group_green, CLUTTER_EASE_OUT_SINE, 500, "x", 0, "y", 0, NULL); 
clutter_actor_animate (group_yellow, CLUTTER_EASE_OUT_SINE, 500, "x", width, "y", 0, NULL); 

哪裏width是包含值200一個gfloat。

回答

1

我學到了答案:clutter_actor_animate需要浮點數值,所以我需要把0.0而不是0。正確的版本是:

clutter_actor_animate (group_red, CLUTTER_EASE_OUT_SINE, 500, "x", 0.0-width, "y", 0.0, NULL); 
clutter_actor_animate (group_green, CLUTTER_EASE_OUT_SINE, 500, "x", 0.0, "y", 0.0, NULL); 
clutter_actor_animate (group_yellow, CLUTTER_EASE_OUT_SINE, 500, "x", width, "y", 0.0, NULL); 
相關問題