diff --git a/doc/cookbook/Makefile.am b/doc/cookbook/Makefile.am index 30f98d635..e29460972 100644 --- a/doc/cookbook/Makefile.am +++ b/doc/cookbook/Makefile.am @@ -28,6 +28,10 @@ XSL_XHTML_URI = $(XSL_BASE_URI)/xhtml/docbook.xsl HTML_FILES = html/*.html CSS_FILES = html/*.css IMAGE_FILES = images/clutter-logo.png +VIDEO_FILES = \ + videos/animations-fading-out.ogv \ + videos/animations-fading-in-then-out.ogv \ + $(NULL) EXTRA_DIST = clutter-cookbook.xml.in $(IMAGE_FILES) $(XML_FILES) diff --git a/doc/cookbook/animations.xml b/doc/cookbook/animations.xml index 17741f929..adc65e75d 100644 --- a/doc/cookbook/animations.xml +++ b/doc/cookbook/animations.xml @@ -88,7 +88,7 @@ -
+
Alphas An alpha is generated for each frame of the animation. @@ -379,4 +379,130 @@ _on_click_cb (ClutterActor *actor,
+
+ Fading an actor out of or into view + +
+ Problem + + You want to animate an actor so that it fades out of or into + view. +
+ +
+ Solution + + Animate the actor's opacity property. + + You can do this using any of the three approaches provided + by the animation API. Here's how to fade out an actor (until it's + completely transparent) using implicit animations: + + + + + + + + Here's an example of a rectangle fading out using this + animation: + + + + + + + Video showing an actor fading out using implicit + animations + + + + CLUTTER_EASE_OUT_CUBIC is one of the + Clutter easing modes; see + the introduction + for more details about what these are and how to choose one. + + Here's an example of the transitions you could use to + fade an actor in and out using ClutterState: + + + + + + + + You would then trigger an animated state change as events + occur in the application (e.g. mouse button clicks): + + + + + + + + Here's an example of this animation fading in then out again: + + + + + + + Video showing an actor fading in then out using + ClutterState + + + + + ClutterState is most useful where you + need to animate an actor backwards and forwards between multiple + states (e.g. fade an actor in and out of view). Where you just + want to fade an actor in or out once, + clutter_actor_animate() is adequate. + + +
+ +
+ Discussion + + Reducing an actor's transparency to zero does not make it + inactive: the actor will still be reactive even if it's not + visible (responding to key events, mouse clicks etc.). + To make it really "disappear", you could use + clutter_actor_hide() once you'd made the actor + fully transparent. + +
+ +
+ diff --git a/doc/cookbook/videos/animations-fading-in-then-out.ogv b/doc/cookbook/videos/animations-fading-in-then-out.ogv new file mode 100644 index 000000000..e8fdc75a3 Binary files /dev/null and b/doc/cookbook/videos/animations-fading-in-then-out.ogv differ diff --git a/doc/cookbook/videos/animations-fading-out.ogv b/doc/cookbook/videos/animations-fading-out.ogv new file mode 100644 index 000000000..93628ff9b Binary files /dev/null and b/doc/cookbook/videos/animations-fading-out.ogv differ