Hi,
I've been using Clutter for a project at work and would like to provide some feedback based on my own experience.

Animations
==========

The animation API leads to code that looks something like this:

anim = clutter_animation_new();
clutter_animation_set_object(anim, G_OBJECT(actor));
clutter_animation_set_duration(anim, 150);
clutter_animation_set_mode(anim, CLUTTER_LINEAR);

/* These two function calls seem rather superfluous */
clutter_animation_set_timeline(anim, NULL);
clutter_animation_set_alpha(anim, NULL);

interval = clutter_interval_new(G_TYPE_UCHAR, 0, 255);
clutter_animation_bind_interval(anim, "opacity", interval);

timeline = clutter_animation_get_timeline(anim);

i) The set_timeline and set_alpha functions seem superfluous and mostly get called, as in the example above, with NULL as the argument.

However, if I do the following:

clutter_animation_set_timeline(anim, timeline);
clutter_animation_set_alpha(anim, alpha);

then:

ii) clutter_animation_set_alpha() silently replaces the timeline I have previously set on the animation with the timeline from the alpha.

Interestingly, if I reverse the operations:

clutter_animation_set_alpha(anim, alpha);
clutter_animation_set_timeline(anim, timeline);

then:

iii) clutter_animation_set_timeline, strangely enough, does not replace the timeline on my alpha, meaning that the animation and the alpha reference different timelines.

iv) Furthermore, ClutterAnimation does not watch for property changes on the Alpha, so I can modify my alpha with clutter_alpha_set_timeline and get the animation and alpha out of sync.


I think I would prefer something like the following:

a) The animation should probably not have a timeline of its own but rather use the timeline of its alpha.

clutter_animation_set_timeline()

- OPTIONAL function to set the timeline for the animation
- ALWAYS sets the timeline on the alpha
- if the animation has no alpha, one is automatically created
- calling with parameter NULL will remove the timeline from the alpha

clutter_animation_set_alpha()

- OPTIONAL function to set an alpha for the animation
- calling with parameter NULL will remove the alpha from the animation

clutter_animation_get_timeline()

- Returns the animation's timeline (the alpha's timeline)
- If animation has no alpha, a new one is automatically created
- If the animation's alpha has no timeline, a new one is automatically created and set on the alpha - The timeline returned is guaranteed to be in sync between the alpha and the animation
- External modifications to the alpha are reflected in the animation's behaviour


Much of the above goes for _set_mode and _set_duration, as well; these are properties of the alpha, and these properties should fall through to the underlying alpha when set on the animation. Likewise, the loop property is a property of the underlying timeline.

This said, the ClutterAnimation becomes just a controller of GObject properties over given intervals based on an underlying implicit or explicit alpha. The alpha, itself, is controlled by an implicit or explicit timeline. The key is that all these objects can be externally manipulated with the desired effects.


Behaviours
==========

It becomes unclear, given Animations above, what the purpose of behaviours are. The only advantage that I see for them today are that they are scriptable, but it seems to me that it should be possible to make Animations scriptable as well.



I hope the above is not too wordy. I'd be interested in any feedback and then I can try to put together some patches that may illustrate things better.

Thanks for Clutter, it's awesome!

Best regards,
Jonas Bonn
South Pole AB

--
To unsubscribe send a mail to [email protected]

Reply via email to