Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 5068

qt-doc-4.8.5-10.fc18.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- animation.qdoc -->
  <title>Qt 4.8: QML Animation and Transitions</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li>QML Animation and Transitions</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
  <link rel="prev" href="qdeclarativestates.html" />
  <link rel="next" href="qdeclarativemodels.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="qdeclarativestates.html">States</a>
<a class="nextPage" href="qdeclarativemodels.html">Structuring Data with Models</a>
</p><p/>
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#animation-and-transitions-elements">Animation and Transitions Elements</a></li>
<li class="level1"><a href="#triggering-animations">Triggering Animations</a></li>
<li class="level2"><a href="#direct-property-animation">Direct Property Animation</a></li>
<li class="level2"><a href="#transitions-during-state-changes">Transitions during State Changes</a></li>
<li class="level2"><a href="#default-animation-as-behaviors">Default Animation as Behaviors</a></li>
<li class="level1"><a href="#playing-animations-in-parallel-or-in-sequence">Playing Animations in Parallel or in Sequence</a></li>
<li class="level1"><a href="#controlling-animations">Controlling Animations</a></li>
<li class="level2"><a href="#animation-playback">Animation Playback</a></li>
<li class="level2"><a href="#easing">Easing</a></li>
<li class="level2"><a href="#other-animation-elements">Other Animation Elements</a></li>
</ul>
</div>
<h1 class="title">QML Animation and Transitions</h1>
<span class="subtitle"></span>
<!-- $$$qdeclarativeanimation.html-description -->
<div class="descr"> <a name="details"></a>
<a name="qml-animation-elements"></a><a name="animation-and-transitions-elements"></a>
<h2>Animation and Transitions Elements</h2>
<ul>
<li><a href="qml-transition.html">Transition</a> - Animates transitions during state changes</li>
<li><a href="qml-sequentialanimation.html">SequentialAnimation</a> - Runs animations sequentially</li>
<li><a href="qml-parallelanimation.html">ParallelAnimation</a> - Runs animations in parallel</li>
<li><a href="qml-behavior.html">Behavior</a> - Specifies a default animation for property changes</li>
<li><a href="qml-propertyaction.html">PropertyAction</a> - Sets immediate property changes during animation</li>
<li><a href="qml-pauseanimation.html">PauseAnimation</a> - Introduces a pause in an animation</li>
<li><a href="qml-smoothedanimation.html">SmoothedAnimation</a> - Allows a property to smoothly track a value</li>
<li><a href="qml-springanimation.html">SpringAnimation</a> - Allows a property to track a value in a spring-like motion</li>
<li><a href="qml-scriptaction.html">ScriptAction</a> - Runs scripts during an animation</li>
</ul>
<a name="qml-property-animation-elements"></a><p>Elements that animate properties based on data types</p>
<ul>
<li><a href="qml-propertyanimation.html">PropertyAnimation</a> - Animates property changes</li>
<li><a href="qml-numberanimation.html">NumberAnimation</a> - Animates properties of type qreal</li>
<li><a href="qml-vector3danimation.html">Vector3dAnimation</a> - Animates properties of type QVector3d</li>
<li><a href="qml-coloranimation.html">ColorAnimation</a> - Animates color changes</li>
<li><a href="qml-rotationanimation.html">RotationAnimation</a> - Animates rotations</li>
<li><a href="qml-parentanimation.html">ParentAnimation</a> - Animates parent changes</li>
<li><a href="qml-anchoranimation.html">AnchorAnimation</a> - Animates anchor changes</li>
</ul>
<p>In QML, animations are created by applying animation elements to property values. Animation elements will interpolate property values to create smooth transitions. As well, state transitions may assign animations to state changes.</p>
<p>To create an animation, use an appropriate animation element for the type of the property that is to be animated, and apply the animation depending on the type of behavior that is required.</p>
<a name="qml-triggering-animations"></a><a name="triggering-animations"></a>
<h2>Triggering Animations</h2>
<p>There are several ways of setting animation to an object.</p>
<a name="qml-direct-animation"></a><a name="direct-property-animation"></a>
<h3>Direct Property Animation</h3>
<p>To create an immediate movement or animated movement, set the property value directly. This may be done in signal handlers or attached properties.</p>
<pre class="qml"> <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">id</span>: <span class="name">blob</span>
     <span class="name">width</span>: <span class="number">75</span>; <span class="name">height</span>: <span class="number">75</span>
     <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>

     <span class="type"><a href="qml-mousearea.html">MouseArea</a></span> {
         <span class="name">anchors</span>.fill: <span class="name">parent</span>
         <span class="name">onClicked</span>: <span class="name">blob</span>.<span class="name">color</span> <span class="operator">=</span> <span class="string">&quot;green&quot;</span>
     }
 }</pre>
<p>However, to create more control, <i>property animations</i> apply smooth movements by interpolating values between property value changes. Property animations provide timing controls and allows different interpolations through <a href="#qml-easing-animation">easing curves</a>.</p>
<pre class="qml"> <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">id</span>: <span class="name">flashingblob</span>
     <span class="name">width</span>: <span class="number">75</span>; <span class="name">height</span>: <span class="number">75</span>
     <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
     <span class="name">opacity</span>: <span class="number">1.0</span>

     <span class="type"><a href="qml-mousearea.html">MouseArea</a></span> {
         <span class="name">anchors</span>.fill: <span class="name">parent</span>
         <span class="name">onClicked</span>: {
             <span class="name">animateColor</span>.<span class="name">start</span>()
             <span class="name">animateOpacity</span>.<span class="name">start</span>()
         }
     }

     <span class="type"><a href="qml-propertyanimation.html">PropertyAnimation</a></span> {<span class="name">id</span>: <span class="name">animateColor</span>; <span class="name">target</span>: <span class="name">flashingblob</span>; <span class="name">properties</span>: <span class="string">&quot;color&quot;</span>; <span class="name">to</span>: <span class="string">&quot;green&quot;</span>; <span class="name">duration</span>: <span class="number">100</span>}

     <span class="type"><a href="qml-numberanimation.html">NumberAnimation</a></span> {
         <span class="name">id</span>: <span class="name">animateOpacity</span>
         <span class="name">target</span>: <span class="name">flashingblob</span>
         <span class="name">properties</span>: <span class="string">&quot;opacity&quot;</span>
         <span class="name">from</span>: <span class="number">0.99</span>
         <span class="name">to</span>: <span class="number">1.0</span>
         <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span>
         <span class="type">easing</span> {<span class="name">type</span>: <span class="name">Easing</span>.<span class="name">OutBack</span>; <span class="name">overshoot</span>: <span class="number">500</span>}
    }
 }</pre>
<p>Specialized <a href="#qml-property-animation-elements">property animation elements</a> have more efficient implementations than the <a href="qml-propertyanimation.html">PropertyAnimation</a> element. They are for setting animations to different QML types such as <tt>int</tt>, <tt>color</tt>, and rotations. Similarly, the <a href="qml-parentanimation.html">ParentAnimation</a> can animate parent changes.</p>
<p>See the <a href="#qml-controlling-animations">Controlling Animations</a> section for more information about the different animation properties.</p>
<a name="qml-transition-animations"></a><a name="transitions-during-state-changes"></a>
<h3>Transitions during State Changes</h3>
<p><a href="qdeclarativestates.html">States</a> are property configurations where a property may have different values to reflect different states. State changes introduce abrupt property changes; animations smooth transitions to produce visually appealing state changes.</p>
<p>The <a href="qml-transition.html">Transition</a> element can contain <a href="#qml-animation-elements">animation elements</a> to interpolate property changes caused by state changes. To assign the transition to an object, bind it to the <tt>transitions</tt> property.</p>
<p>A button might have two states, the <tt>pressed</tt> state when the user clicks on the button and a <tt>released</tt> state when the user releases the button. We can assign different property configurations for each state. A transition would animate the change from the <tt>pressed</tt> state to the <tt>released</tt> state. Likewise, there would be an animation during the change from the <tt>released</tt> state to the <tt>pressed</tt> state.</p>
<pre class="qml"> <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">width</span>: <span class="number">75</span>; <span class="name">height</span>: <span class="number">75</span>
     <span class="name">id</span>: <span class="name">button</span>
     <span class="name">state</span>: <span class="string">&quot;RELEASED&quot;</span>

     <span class="type"><a href="qml-mousearea.html">MouseArea</a></span> {
         <span class="name">anchors</span>.fill: <span class="name">parent</span>
         <span class="name">onPressed</span>: <span class="name">button</span>.<span class="name">state</span> <span class="operator">=</span> <span class="string">&quot;PRESSED&quot;</span>
         <span class="name">onReleased</span>: <span class="name">button</span>.<span class="name">state</span> <span class="operator">=</span> <span class="string">&quot;RELEASED&quot;</span>
     }

     <span class="name">states</span>: [
         <span class="type"><a href="qml-state.html">State</a></span> {
             <span class="name">name</span>: <span class="string">&quot;PRESSED&quot;</span>
             <span class="type"><a href="qml-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">button</span>; <span class="name">color</span>: <span class="string">&quot;lightblue&quot;</span>}
         },
         <span class="type"><a href="qml-state.html">State</a></span> {
             <span class="name">name</span>: <span class="string">&quot;RELEASED&quot;</span>
             <span class="type"><a href="qml-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">button</span>; <span class="name">color</span>: <span class="string">&quot;lightsteelblue&quot;</span>}
         }
     ]

     <span class="name">transitions</span>: [
         <span class="type"><a href="qml-transition.html">Transition</a></span> {
             <span class="name">from</span>: <span class="string">&quot;PRESSED&quot;</span>
             <span class="name">to</span>: <span class="string">&quot;RELEASED&quot;</span>
             <span class="type"><a href="qml-coloranimation.html">ColorAnimation</a></span> { <span class="name">target</span>: <span class="name">button</span>; <span class="name">duration</span>: <span class="number">100</span>}
         },
         <span class="type"><a href="qml-transition.html">Transition</a></span> {
             <span class="name">from</span>: <span class="string">&quot;RELEASED&quot;</span>
             <span class="name">to</span>: <span class="string">&quot;PRESSED&quot;</span>
             <span class="type"><a href="qml-coloranimation.html">ColorAnimation</a></span> { <span class="name">target</span>: <span class="name">button</span>; <span class="name">duration</span>: <span class="number">100</span>}
         }
     ]
 }</pre>
<p>Binding the <tt>to</tt> and <tt>from</tt> properties to the state's name will assign that particular transition to the state change. For simple or symmetric transitions, setting the to <tt>to</tt> property to the wild card symbol, &quot;<tt>*</tt>&quot;, denotes that the transition applies to any state change.</p>
<pre class="qml">     <span class="name">transitions</span>:
         <span class="name">Transition</span> {
             <span class="name">to</span>: <span class="string">&quot;*&quot;</span>
             <span class="type"><a href="qml-coloranimation.html">ColorAnimation</a></span> { <span class="name">target</span>: <span class="name">button</span>; <span class="name">duration</span>: <span class="number">100</span>}
         }</pre>
<a name="default-animation-as-behaviors"></a>
<h3>Default Animation as Behaviors</h3>
<p>Default property animations are set using <i>behavior animations</i>. Animations declared in <a href="qml-behavior.html">Behavior</a> elements apply to the property and animates any property value changes. However, Behavior elements have an <tt>enabled</tt> property to purposely enable or disable the behavior animations.</p>
<p>A ball component might have a behavior animation assigned to its <tt>x</tt>, <tt>y</tt>, and <tt>color</tt> properties. The behavior animation could be set up to simulate an elastic effect. In effect, this behavior animation would apply the elastic effect to the properties whenever the ball moves.</p>
<pre class="qml"> <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">width</span>: <span class="number">75</span>; <span class="name">height</span>: <span class="number">75</span>; <span class="name">radius</span>: <span class="name">width</span>
     <span class="name">id</span>: <span class="name">ball</span>
     <span class="name">color</span>: <span class="string">&quot;salmon&quot;</span>

     Behavior on <span class="name">x</span> {
         <span class="type"><a href="qml-numberanimation.html">NumberAnimation</a></span> {
             <span class="name">id</span>: <span class="name">bouncebehavior</span>
             <span class="type">easing</span> {
                 <span class="name">type</span>: <span class="name">Easing</span>.<span class="name">OutElastic</span>
                 <span class="name">amplitude</span>: <span class="number">1.0</span>
                 <span class="name">period</span>: <span class="number">0.5</span>
             }
         }
     }
     Behavior on <span class="name">y</span> {
         <span class="name">animation</span>: <span class="name">bouncebehavior</span>
     }
     <span class="type"><a href="qml-behavior.html">Behavior</a></span> {
         <span class="type"><a href="qml-coloranimation.html">ColorAnimation</a></span> { <span class="name">target</span>: <span class="name">ball</span>; <span class="name">duration</span>: <span class="number">100</span> }
     }
 }</pre>
<p>There are several methods of assigning behavior animations to properties. The <tt>Behavior on &lt;property&gt;</tt> declaration is a convenient way of assigning a behavior animation onto a property.</p>
<p>See the <a href="declarative-animation-behaviors-behavior-example.html">Behaviors example</a> for a demonstration of behavioral animations.</p>
<a name="playing-animations-in-parallel-or-in-sequence"></a>
<h2>Playing Animations in Parallel or in Sequence</h2>
<p>Animations can run <i>in parallel</i> or <i>in sequence</i>. Parallel animations will play a group of animations at the same time while sequential animations play a group of animations in order: one after the other. Grouping animations in <a href="qml-sequentialanimation.html">SequentialAnimation</a> and <a href="qml-parallelanimation.html">ParallelAnimation</a> will play the animations in sequence or in parallel.</p>
<p>A banner component may have several icons or slogans to display, one after the other. The <tt>opacity</tt> property could transform to <tt>1.0</tt> denoting an opaque object. Using the <a href="qml-sequentialanimation.html">SequentialAnimation</a> element, the opacity animations will play after the preceding animation finishes. The <a href="qml-parallelanimation.html">ParallelAnimation</a> element will play the animations at the same time.</p>
<pre class="qml"> <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">id</span>: <span class="name">banner</span>
     <span class="name">width</span>: <span class="number">150</span>; <span class="name">height</span>: <span class="number">100</span>; <span class="name">border</span>.color: <span class="string">&quot;black&quot;</span>

     <span class="type"><a href="qml-column.html">Column</a></span> {
         <span class="name">anchors</span>.centerIn: <span class="name">parent</span>
         <span class="type"><a href="qml-text.html">Text</a></span> {
             <span class="name">id</span>: <span class="name">code</span>
             <span class="name">text</span>: <span class="string">&quot;Code less.&quot;</span>
             <span class="name">opacity</span>: <span class="number">0.01</span>
         }
         <span class="type"><a href="qml-text.html">Text</a></span> {
             <span class="name">id</span>: <span class="name">create</span>
             <span class="name">text</span>: <span class="string">&quot;Create more.&quot;</span>
             <span class="name">opacity</span>: <span class="number">0.01</span>
         }
         <span class="type"><a href="qml-text.html">Text</a></span> {
             <span class="name">id</span>: <span class="name">deploy</span>
             <span class="name">text</span>: <span class="string">&quot;Deploy everywhere.&quot;</span>
             <span class="name">opacity</span>: <span class="number">0.01</span>
         }
     }

     <span class="type"><a href="qml-mousearea.html">MouseArea</a></span> {
         <span class="name">anchors</span>.fill: <span class="name">parent</span>
         <span class="name">onPressed</span>: <span class="name">playbanner</span>.<span class="name">start</span>()
     }

     <span class="type"><a href="qml-sequentialanimation.html">SequentialAnimation</a></span> {
         <span class="name">id</span>: <span class="name">playbanner</span>
         <span class="name">running</span>: <span class="number">false</span>
         <span class="type"><a href="qml-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">code</span>; <span class="name">property</span>: <span class="string">&quot;opacity&quot;</span>; <span class="name">to</span>: <span class="number">1.0</span>; <span class="name">duration</span>: <span class="number">200</span>}
         <span class="type"><a href="qml-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">create</span>; <span class="name">property</span>: <span class="string">&quot;opacity&quot;</span>; <span class="name">to</span>: <span class="number">1.0</span>; <span class="name">duration</span>: <span class="number">200</span>}
         <span class="type"><a href="qml-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">deploy</span>; <span class="name">property</span>: <span class="string">&quot;opacity&quot;</span>; <span class="name">to</span>: <span class="number">1.0</span>; <span class="name">duration</span>: <span class="number">200</span>}
     }
 }</pre>
<p>Once individual animations are placed into a <a href="qml-sequentialanimation.html">SequentialAnimation</a> or <a href="qml-parallelanimation.html">ParallelAnimation</a>, they can no longer be started and stopped independently. The sequential or parallel animation must be started and stopped as a group.</p>
<p>The <a href="qml-sequentialanimation.html">SequentialAnimation</a> element is also useful for playing <a href="#qml-transition-animations">transition animations</a> because animations are played in parallel inside transitions.</p>
<p>See the Animation basics example for a demonstration of creating and combining multiple animations in QML.</p>
<a name="qml-controlling-animations"></a><a name="controlling-animations"></a>
<h2>Controlling Animations</h2>
<p>There are different methods to control animations.</p>
<a name="animation-playback"></a>
<h3>Animation Playback</h3>
<p>All <a href="#qml-animation-elements">animation elements</a> inherit from the <a href="qml-animation.html">Animation</a> element. It is not possible to create <a href="qml-animation.html">Animation</a> objects; instead, this element provides the essential properties and methods for animation elements. Animation elements have <tt>start()</tt>, <tt>stop()</tt>, <tt>resume()</tt>, <tt>pause()</tt>, <tt>restart()</tt>, and <tt>complete()</tt> -- all of these methods control the execution of animations.</p>
<a name="qml-easing-animation"></a><a name="easing"></a>
<h3>Easing</h3>
<p>Easing curves define how the animation will interpolate between the start value and the end value. Different easing curves might go beyond the defined range of interpolation. The easing curves simplify the creation of animation effects such as bounce effects, acceleration, deceleration, and cyclical animations.</p>
<p>A QML object may have different easing curve for each property animation. There are also different parameters to control the curve, some of which are exclusive to a particular curve. For more information about the easing curves, visit the <a href="qml-propertyanimation.html#easing.type-prop">easing</a> documentation.</p>
<p>The <a href="declarative-animation-easing.html">easing example</a> visually demonstrates each of the different easing types.</p>
<a name="other-animation-elements"></a>
<h3>Other Animation Elements</h3>
<p>In addition, QML provides several other elements useful for animation:</p>
<ul>
<li><a href="qml-pauseanimation.html">PauseAnimation</a>: enables pauses during animations</li>
<li><a href="qml-scriptaction.html">ScriptAction</a>: allows JavaScript to be executed during an animation, and can be used together with <a href="qml-statechangescript.html">StateChangeScript</a> to reused existing scripts</li>
<li><a href="qml-propertyaction.html">PropertyAction</a>: changes a property <i>immediately</i> during an animation, without animating the property change</li>
</ul>
<p>These are specialized animation elements that animate different property types</p>
<ul>
<li><a href="qml-smoothedanimation.html">SmoothedAnimation</a>: a specialized <a href="qml-numberanimation.html">NumberAnimation</a> that provides smooth changes in animation when the target value changes</li>
<li><a href="qml-springanimation.html">SpringAnimation</a>: provides a spring-like animation with specialized attributes such as <a href="qml-springanimation.html#mass-prop">mass</a>, <a href="qml-springanimation.html#damping-prop">damping</a> and <a href="qml-springanimation.html#epsilon-prop">epsilon</a></li>
<li><a href="qml-parentanimation.html">ParentAnimation</a>: used for animating a parent change (see <a href="qml-parentchange.html">ParentChange</a>)</li>
<li><a href="qml-anchoranimation.html">AnchorAnimation</a>: used for animating an anchor change (see <a href="qml-anchorchanges.html">AnchorChanges</a>)</li>
</ul>
</div>
<!-- @@@qdeclarativeanimation.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="qdeclarativestates.html">States</a>
<a class="nextPage" href="qdeclarativemodels.html">Structuring Data with Models</a>
</p>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>