From: Elliot Smith Date: Fri, 16 Jul 2010 11:34:44 +0000 (+0100) Subject: cookbook: Added recipe for fading actors in/out X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=962b3c68857813967c3f3fc62ca87e7e3bc9cf6d;p=profile%2Fivi%2Fclutter.git cookbook: Added recipe for fading actors in/out Added a recipe showing how to fade actors in/out by animating their opacity property, using both implicit animations and ClutterState. --- diff --git a/doc/cookbook/Makefile.am b/doc/cookbook/Makefile.am index 30f98d6..e294609 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 17741f9..adc65e7 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 0000000..e8fdc75 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 0000000..93628ff Binary files /dev/null and b/doc/cookbook/videos/animations-fading-out.ogv differ