layout: Add animation support to LayoutManager

In order to animate a fluid layout we cannot use the common animation
code paths as they will override the size request and allocation paths
that are handled by the layout manager itself.

One way to introduce animations in the allocation sequence is to use a
Timeline and an Alpha to compute a progress value and then use that
value to interpolate an ActorBox between the initial and final states of
the animation - with the initial state being the last allocation of the
child prior to the animation start, and the final state the allocation
of the child at the end; for every frame of the Timeline we then queue a
relayout on the layout manager's container, which will result in an
animation.

ClutterLayoutManager is the most likely place to add a generic API for
beginning and ending an animation, as well as the place to provide a
default code path to create the ancillary Timeline and Alpha instances
needed to drive the animation.

A LayoutManager sub-class will need to:

  • call clutter_layout_manager_begin_animation() whenever it should
    animate between two states, for instance: whenever a layout property
    changes value;
  • eventually override begin_animation() and end_animation() in case
    further state needs to be set up, and then chain up to the default
    implementation provided by LayoutManager;
  • if a completely different implementation is required, the layout
    manager sub-class should override begin_animation(), end_animation()
    and get_animation_progress().

Inside the allocate() implementation the sub-class should also
interpolate between the last known allocation of a child and the newly
computed allocation.
This commit is contained in:
Emmanuele Bassi
2009-12-12 00:02:43 +00:00
parent 999359d64c
commit f94a903d9e
3 changed files with 204 additions and 22 deletions

View File

@ -1768,6 +1768,11 @@ clutter_layout_manager_child_get_property
clutter_layout_manager_find_child_property
clutter_layout_manager_list_child_properties
<SUBSECTION>
clutter_layout_manager_begin_animation
clutter_layout_manager_end_animation
clutter_layout_manager_get_animation_progress
<SUBSECTION Standard>
CLUTTER_TYPE_LAYOUT_MANAGER
CLUTTER_LAYOUT_MANAGER