Added 3 examples for the box layout recipe:
1) Simple box layout demonstrating how to set actor properties
2) Trivial menu implementation using box layout
3) Demonstration app which enables tweaking and testing
of layout property interactions
Also inlined example 1 in the solution section and added
more explanatory text in the discussion.
Other frameworks expose the same functionality as "auto-reverse",
probably to match the cassette tape player. It actually makes sense
for Clutter to follow suit.
clutter_timeline_set_reverse() can be used to
automatically reverse a timeline's direction each time
it completes, so use that in looping animation recipe and
examples.
* elliot/cookbook-animations-scaling:
cookbook: Add recipe for animated scaling of an actor
cookbook: Add example of scaling a texture
cookbook: Added "animated scaling" recipe skeleton
cookbook: Added animated scaling example
Recipe explains how to animate scaling a single actor.
Also covers scaling vs. resizing, scale center, and
scaling within layouts and containers.
The first example shows how animations around each scale
gravity look, as well as tracking the transformed position
and size of the actor and displaying those.
The second example is a simple image viewer with zoom in/out
using scaling.
Added an example showing scaling of an actor on
each of the scaling gravity settings (NORTH_WEST, NORTH etc.),
with a mark indicating the center being used.
Displays the transformed size and position, updated
on each paint of the actor.
* elliot/cookbook-animations-looping:
cookbook: Recipe for "looping animations"
cookbook: Clarify how signals are emitted during looped animation
cookbook: First draft for looping animations recipe
cookbook: Recipe skeleton for "looping animations"
cookbook: Looping animation examples
Added a recipe giving examples of how to loop
animations for each part of the animation API (implicit,
animator, state).
The discussion covers looping a fixed number of times
and inverting a single implicit animation to create
a loop which goes back to its start on each iteration.
Recipe covers adding handlers for button-press-event and
button-release-event signals on actors, and how to
examine the content of a ClutterButtonEvent via API functions.
The discussion section explains about click count
(the criteria for how clicks get counted, including
distance and time settings); how button numbers are reported;
and how to use ClutterClickAction as an alternative
for press + release in certain scenarios.
This recipe explains how to use the three animation
approaches (implicit, State, Animator) to animate movement
of actors.
Includes some guidelines about which approach to use when, with
a full code example for each approach.
The discussion section covers some subtleties around animated
movement; namely: moving actors out of their containers; anchor
points and movement; moving in the depth axis; interactions
between animated movement and constraints.
Added an example showing how to move two actors between
two states (one minimised, one maximised) using ClutterState
to do the movement. Also shows how movement can be mixed
with other animation (in this case, scaling).
The recipe covers how to use ClutterBindConstraint
to bind actor sizes together.
It gives some examples of where this approach is appropriate,
as well as explaining an alternative using allocation-changed
or notify::* signals.
Three examples are given:
1. Resizing a texture to the stage.
2. Resizing a rectangle to act as a transparent overlay on
top of a texture (using constraints).
3. Resizing a rectangle to act as a transparent overlay on
top of a texture, but with a size proportional to the texture
(using a handler connected to allocation-changed signals
emitted by the texture).
An alternative method (not using constraints) to bind
one actor's size and position to another. Used as
an example in the recipe about resizing one actor in
sync with a source actor.
A simple example showing how to scale an actor to the stage.
Demonstrates ClutterBindConstraint and ClutterAlignConstraint
in a fashion suitable for a short recipe.
Example code which loads an image into a texture, and resizes
the image in response to +/- key presses. The overlay is
a transparent rectangle which is bound to the height and
width of the texture; on clicking the texture, the overlay
is made visible by increasing its opacity.
This demonstrates how to use constraints to simplify code
for resizing an actor which is "dependent" on another actor.
This recipe explains how to "reuse" the same animation
definition for different actors, by creating a new
instance of a "rig" (empty container) and animation
for the rig each time the animation is required.
An actor is then re-parented to the rig and animated
using it, rather than being animated directly.
JSON is used to define the rig + animator, to make
creating new instances of them simpler. The recipe
also discusses various caveats around using this
approach, rather than directly animating an actor.
Modified the "animation reuse" sample code to provide
a simpler example to explain in the recipe.
Also modified variable names to mirror the names used
for the previous "complex animation" example and added
some more comments, to further simplify and support the
recipe.
With some help from pippin, moved variable declarations
into more sensible positions within their functions,
changed a function name, and found a better way
to unref a script once its associated actor has
been destroyed.
Extracted the animation into its own JSON definition,
then create a new script and get the animation each
time a rectangle is clicked.
Removes the need to reparent onto the background and
copy property values to the rectangle after the animation,
and generally much cleaner.
Added an example showing how to reuse a ClutterAnimator
instance to animate multiple actors at different times
using an animatable rig, combined with reparenting.