diff --git a/doc/cookbook/animations.xml b/doc/cookbook/animations.xml index 6c0a674ea..2534f29dc 100644 --- a/doc/cookbook/animations.xml +++ b/doc/cookbook/animations.xml @@ -2709,7 +2709,20 @@ timeline_completed_cb (ClutterTimeline *timeline,
Problem - You want to animate scaling of an actor. + You want to animate scaling of an actor. Example use + cases: + + + + To animate zooming in/out of a texture in an + image viewer application. + + + To add an animated "bounce" effect (quick scale up + followed by scale down) to a UI element + to indicate it has received focus. + +
@@ -2717,18 +2730,19 @@ timeline_completed_cb (ClutterTimeline *timeline, Animate the actor's scale-x and scale-y properties to change the scaling on - the x and y axes respectively. + the x and y axes + respectively. - For example, to animate an actor to twice its initial scale + For example, to animate an actor to twice its current scale with implicit animations: Alternatively, ClutterAnimator or ClutterState can be used to animate an actor's scale properties. See this - example for details. + example which uses ClutterState to animate + scaling.
Discussion - + + Scaling can easily change the apparent size + of multiple actors inside a container. For example, say you + wanted to shrink multiple actors inside a container + to half their original size. There are two ways you + could do this: + + + + The hard way would be to resize + each actor individually. You couldn't just resize the container, + as resizing a container doesn't resize its children: usually + they will be clipped so that they are either partially or + wholly hidden. + + + + The easy way would be to set the container's scale + to half its initial value: the actors + in the container would retain their original sizes, but would + appear at half size. + + + + + +
+ +
+ Scaling, layouts and containers + + It is possible to scale actors inside containers. For + example, if you were using a ClutterBox + which has a ClutterBoxLayout layout manager, + you could scale the children of that layout. + + However, you should remain aware that layout managers + don't take account of the scale of their children, only their + size. So if you scale up an actor inside a layout manager, + it may overlap other actors in the layout: the size allocated + by the layout manager doesn't increase as an actor's scale + increases. + + Similarly, scaling an actor down doesn't reduce the space + it will be allocated by a layout. +
Setting the scale center - + If this isn't desirable, you can just retain the scale + center on a scaled actor, and only change it when the actor + is unscaled. +
@@ -2828,6 +3026,17 @@ Note that the scale center is relative to the actor's actual size, not its trans a code sample should be here... but isn't + + + + + + Animated scaling (up and down) of a texture in response + to button presses. Call with the path to an image as the + first argument. + + + a code sample should be here... but isn't