简体   繁体   English

为什么clutter_actor_animate影响错误的演员?

[英]Why is clutter_actor_animate affecting the wrong actors?

I've been playing around with Clutter, using this tutorial as reference, and am trying to animate three groups, each containing a colored rectangle. 我一直在使用本教程作为参考来玩弄Clutter,并尝试制作三个动画组,每个动画组包含一个彩色矩形。 I am trying to use the clutter_actor_animate method used in the tutorial. 我正在尝试使用本教程中使用的clutter_actor_animate方法。 If I animate just one of the three, it works; 如果仅使三个动画之一,则它会起作用。 however, if I try to animate two or more groups, the first animation seems to apply to all animations. 但是,如果尝试为两个或更多组设置动画,则第一个动画似乎适用于所有动画。 Why is this? 为什么是这样? Here is the relevant part of my code: 这是我的代码的相关部分:

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);

Where width is a gfloat containing the value 200 . 其中width是包含值200的gfloat。

I learned the answer: clutter_actor_animate requires floats for those values, so I needed to put 0.0 instead of 0 . 我了解了答案: clutter_actor_animate需要这些值的浮点数,因此我需要将0.0而不是0放进去。 The correct version is: 正确的版本是:

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM