Search code examples
animationgnomevalaclutter

What is the proper way to animate clutter actors that have been added in a LayoutManager?


I have a stage that contains a number of Clutter.Actor (and one GtkClutter.Actor embedding a TreeView) that were added to a layout manager (let's say the GridLayout).

And now I want to move them around with animations, using translation_x, translation_y and resizing their width.

What is the recommended way to do that?

Won't the layout that places actors according to rules conflict with the new positions of the actors?

Should I sever the ties to the layout (by nullify the layoutmanager property) ?


Solution

  • All ClutterLayoutManager implementations respect the easing state of an actor, so if you set the duration of the easing state to a non-zero value, all changes in allocation will be implicitly animated. You can see the effect in the layout manager example shipped with Clutter itself.

    An easing state with a non-zero duration will also allow you to transition things like width and height properties, as well as the transformation properties, such as translation-x and translation-y.

    It is important to note, though, that transformation properties do not affect layout management; if you change the scale, depth, rotation, or translation of an actor, you do so after the actor has been given an allocation. You can use this knowledge to implement transitions.