/usr/share/qt5/doc/qtquick/qtquick-animation-example.html is in qtdeclarative5-doc-html 5.2.1-3ubuntu15.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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 Quick Examples - Animation | QtQuick 5.2</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li>Qt 5.2</li>
<li><a href="qtquick-index.html">Qt Quick</a></li>
<li>Qt Quick Examples - Animation</li>
<li id="buildversion">
Qt 5.2.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<h1 class="title">Qt Quick Examples - Animation</h1>
<span class="subtitle"></span>
<!-- $$$animation-description -->
<div class="descr"> <a name="details"></a>
<p>This is a collection of QML Animation examples.<p class="centerAlign"><img src="images/qml-animations-example.png" alt="" /></p><p>This is a collection of small QML examples relating to animation. Each example is a small QML file emphasizing a particular type or feature.</p>
<p><a href="qml-qtquick-coloranimation.html">ColorAnimation</a> demonstrates using a color animation to fade a sky from day to night.</p>
<pre class="qml"><span class="name">gradient</span>: <span class="name">Gradient</span> {
<span class="type"><a href="qml-qtquick-gradientstop.html">GradientStop</a></span> {
<span class="name">position</span>: <span class="number">0.0</span>
SequentialAnimation on <span class="name">color</span> {
<span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span>
<span class="type"><a href="qml-qtquick-coloranimation.html">ColorAnimation</a></span> { <span class="name">from</span>: <span class="string">"DeepSkyBlue"</span>; <span class="name">to</span>: <span class="string">"#0E1533"</span>; <span class="name">duration</span>: <span class="number">5000</span> }
<span class="type"><a href="qml-qtquick-coloranimation.html">ColorAnimation</a></span> { <span class="name">from</span>: <span class="string">"#0E1533"</span>; <span class="name">to</span>: <span class="string">"DeepSkyBlue"</span>; <span class="name">duration</span>: <span class="number">5000</span> }
}
}
<span class="type"><a href="qml-qtquick-gradientstop.html">GradientStop</a></span> {
<span class="name">position</span>: <span class="number">1.0</span>
SequentialAnimation on <span class="name">color</span> {
<span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span>
<span class="type"><a href="qml-qtquick-coloranimation.html">ColorAnimation</a></span> { <span class="name">from</span>: <span class="string">"SkyBlue"</span>; <span class="name">to</span>: <span class="string">"#437284"</span>; <span class="name">duration</span>: <span class="number">5000</span> }
<span class="type"><a href="qml-qtquick-coloranimation.html">ColorAnimation</a></span> { <span class="name">from</span>: <span class="string">"#437284"</span>; <span class="name">to</span>: <span class="string">"SkyBlue"</span>; <span class="name">duration</span>: <span class="number">5000</span> }
}
}
}</pre>
<p><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a> demonstrates using a number animation to bounce a circle up and down.</p>
<pre class="qml"><span class="comment">// Animate the y property. Setting loops to Animation.Infinite makes the</span>
<span class="comment">// animation repeat indefinitely, otherwise it would only run once.</span>
SequentialAnimation on <span class="name">y</span> {
<span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span>
<span class="comment">// Move from minHeight to maxHeight in 300ms, using the OutExpo easing function</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {
<span class="name">from</span>: <span class="name">smiley</span>.<span class="name">minHeight</span>; <span class="name">to</span>: <span class="name">smiley</span>.<span class="name">maxHeight</span>
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutExpo</span>; <span class="name">duration</span>: <span class="number">300</span>
}
<span class="comment">// Then move back to minHeight in 1 second, using the OutBounce easing function</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {
<span class="name">from</span>: <span class="name">smiley</span>.<span class="name">maxHeight</span>; <span class="name">to</span>: <span class="name">smiley</span>.<span class="name">minHeight</span>
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutBounce</span>; <span class="name">duration</span>: <span class="number">1000</span>
}
<span class="comment">// Then pause for 500ms</span>
<span class="type"><a href="qml-qtquick-pauseanimation.html">PauseAnimation</a></span> { <span class="name">duration</span>: <span class="number">500</span> }
}</pre>
<p>Animators demonstrates using a animators to bounce an icon up and down.</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-sequentialanimation.html">SequentialAnimation</a></span> {
<span class="type"><a href="qml-qtquick-sequentialanimation.html">SequentialAnimation</a></span> {
<span class="type"><a href="qml-qtquick-parallelanimation.html">ParallelAnimation</a></span> {
<span class="type"><a href="qml-qtquick-yanimator.html">YAnimator</a></span> {
<span class="name">target</span>: <span class="name">smiley</span>;
<span class="name">from</span>: <span class="name">smiley</span>.<span class="name">minHeight</span>;
<span class="name">to</span>: <span class="name">smiley</span>.<span class="name">maxHeight</span>
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutExpo</span>;
<span class="name">duration</span>: <span class="number">300</span>
}
<span class="type"><a href="qml-qtquick-scaleanimator.html">ScaleAnimator</a></span> {
<span class="name">target</span>: <span class="name">shadow</span>
<span class="name">from</span>: <span class="number">1</span>
<span class="name">to</span>: <span class="number">0.5</span>
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutExpo</span>;
<span class="name">duration</span>: <span class="number">300</span>
}
}
<span class="type"><a href="qml-qtquick-parallelanimation.html">ParallelAnimation</a></span> {
<span class="type"><a href="qml-qtquick-yanimator.html">YAnimator</a></span> {
<span class="name">target</span>: <span class="name">smiley</span>;
<span class="name">from</span>: <span class="name">smiley</span>.<span class="name">maxHeight</span>;
<span class="name">to</span>: <span class="name">smiley</span>.<span class="name">minHeight</span>
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutBounce</span>;
<span class="name">duration</span>: <span class="number">1000</span>
}
<span class="type"><a href="qml-qtquick-scaleanimator.html">ScaleAnimator</a></span> {
<span class="name">target</span>: <span class="name">shadow</span>
<span class="name">from</span>: <span class="number">0.5</span>
<span class="name">to</span>: <span class="number">1</span>
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutBounce</span>;
<span class="name">duration</span>: <span class="number">1000</span>
}
}
}
<span class="type"><a href="qml-qtquick-pauseanimation.html">PauseAnimation</a></span> { <span class="name">duration</span>: <span class="number">500</span> }
<span class="name">running</span>: <span class="number">true</span>
<span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span>
}</pre>
<p>Behaviors demonstrates using behaviors to animate moving a rectangle to whereever you click.</p>
<pre class="qml"><span class="comment">// Set an 'elastic' behavior on the focusRect's y property.</span>
Behavior on <span class="name">y</span> {
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutElastic</span>; <span class="name">easing</span>.amplitude: <span class="number">3.0</span>; <span class="name">easing</span>.period: <span class="number">2.0</span>; <span class="name">duration</span>: <span class="number">300</span> }
}</pre>
<p>Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it. It does this by assigning a complex binding to each letter:</p>
<pre class="qml"> <span class="name">x</span>: <span class="name">follow</span> ? <span class="name">follow</span>.<span class="name">x</span> <span class="operator">+</span> <span class="name">follow</span>.<span class="name">width</span> : <span class="name">container</span>.<span class="name">width</span> <span class="operator">/</span> <span class="number">6</span>
<span class="name">y</span>: <span class="name">follow</span> ? <span class="name">follow</span>.<span class="name">y</span> : <span class="name">container</span>.<span class="name">height</span> <span class="operator">/</span> <span class="number">2</span></pre>
<p>Then, it uses behaviors to animate the movement on each letter:</p>
<pre class="qml"> Behavior on <span class="name">x</span> { <span class="name">enabled</span>: <span class="name">container</span>.<span class="name">animated</span>; <span class="type"><a href="qml-qtquick-springanimation.html">SpringAnimation</a></span> { <span class="name">spring</span>: <span class="number">3</span>; <span class="name">damping</span>: <span class="number">0.3</span>; <span class="name">mass</span>: <span class="number">1.0</span> } }
Behavior on <span class="name">y</span> { <span class="name">enabled</span>: <span class="name">container</span>.<span class="name">animated</span>; <span class="type"><a href="qml-qtquick-springanimation.html">SpringAnimation</a></span> { <span class="name">spring</span>: <span class="number">3</span>; <span class="name">damping</span>: <span class="number">0.3</span>; <span class="name">mass</span>: <span class="number">1.0</span> } }</pre>
<p>Tv Tennis demonstrates using more complex behaviors to get paddles following a ball for an infinite game. Again a binding which depends on other values is applied to the position and a behavior provided the animation.</p>
<pre class="qml"><span class="name">y</span>: <span class="name">ball</span>.<span class="name">direction</span> <span class="operator">==</span> <span class="string">'left'</span> ? <span class="name">ball</span>.<span class="name">y</span> <span class="operator">-</span> <span class="number">45</span> : <span class="name">page</span>.<span class="name">height</span><span class="operator">/</span><span class="number">2</span> <span class="operator">-</span><span class="number">45</span>;
Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-springanimation.html">SpringAnimation</a></span>{ <span class="name">velocity</span>: <span class="number">300</span> } }</pre>
<p>Easing Curves shows off all the easing curves available in Qt Quick animations.</p>
<p>States demonstrates how the properties of an item can vary between states. It defines several states:</p>
<pre class="qml"><span class="comment">// In state 'middleRight', move the image to middleRightRect</span>
<span class="type"><a href="qml-qtquick-state.html">State</a></span> {
<span class="name">name</span>: <span class="string">"middleRight"</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">userIcon</span>; <span class="name">x</span>: <span class="name">middleRightRect</span>.<span class="name">x</span>; <span class="name">y</span>: <span class="name">middleRightRect</span>.<span class="name">y</span> }
},
<span class="comment">// In state 'bottomLeft', move the image to bottomLeftRect</span>
<span class="type"><a href="qml-qtquick-state.html">State</a></span> {
<span class="name">name</span>: <span class="string">"bottomLeft"</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">userIcon</span>; <span class="name">x</span>: <span class="name">bottomLeftRect</span>.<span class="name">x</span>; <span class="name">y</span>: <span class="name">bottomLeftRect</span>.<span class="name">y</span> }
}</pre>
<p>Note that there is also the implicit 'base state' from properties set directly on objects.</p>
<p>Transitions takes the States example and animates the property changes by setting transitions:</p>
<pre class="qml"><span class="comment">// Transitions define how the properties change when the item moves between each state</span>
<span class="name">transitions</span>: [
<span class="comment">// When transitioning to 'middleRight' move x,y over a duration of 1 second,</span>
<span class="comment">// with OutBounce easing function.</span>
<span class="type"><a href="qml-qtquick-transition.html">Transition</a></span> {
<span class="name">from</span>: <span class="string">"*"</span>; <span class="name">to</span>: <span class="string">"middleRight"</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">properties</span>: <span class="string">"x,y"</span>; <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutBounce</span>; <span class="name">duration</span>: <span class="number">1000</span> }
},
<span class="comment">// When transitioning to 'bottomLeft' move x,y over a duration of 2 seconds,</span>
<span class="comment">// with InOutQuad easing function.</span>
<span class="type"><a href="qml-qtquick-transition.html">Transition</a></span> {
<span class="name">from</span>: <span class="string">"*"</span>; <span class="name">to</span>: <span class="string">"bottomLeft"</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">properties</span>: <span class="string">"x,y"</span>; <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InOutQuad</span>; <span class="name">duration</span>: <span class="number">2000</span> }
},
<span class="comment">// For any other state changes move x,y linearly over duration of 200ms.</span>
<span class="type"><a href="qml-qtquick-transition.html">Transition</a></span> {
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">properties</span>: <span class="string">"x,y"</span>; <span class="name">duration</span>: <span class="number">200</span> }
}</pre>
<p><a href="qml-qtquick-pathanimation.html">PathAnimation</a> animates an image along a beizer curve using a <a href="qml-qtquick-pathanimation.html">PathAnimation</a>.</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-pathanimation.html">PathAnimation</a></span> {
<span class="name">id</span>: <span class="name">pathAnim</span>
<span class="name">duration</span>: <span class="number">2000</span>
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InQuad</span>
<span class="name">target</span>: <span class="name">box</span>
<span class="name">orientation</span>: <span class="name">PathAnimation</span>.<span class="name">RightFirst</span>
<span class="name">anchorPoint</span>: <span class="name">Qt</span>.<span class="name">point</span>(<span class="name">box</span>.<span class="name">width</span><span class="operator">/</span><span class="number">2</span>, <span class="name">box</span>.<span class="name">height</span><span class="operator">/</span><span class="number">2</span>)
<span class="name">path</span>: <span class="name">Path</span> {
<span class="name">startX</span>: <span class="number">50</span>; <span class="name">startY</span>: <span class="number">50</span>
<span class="type"><a href="qml-qtquick-pathcubic.html">PathCubic</a></span> {
<span class="name">x</span>: <span class="name">window</span>.<span class="name">width</span> <span class="operator">-</span> <span class="number">50</span>
<span class="name">y</span>: <span class="name">window</span>.<span class="name">height</span> <span class="operator">-</span> <span class="number">50</span>
<span class="name">control1X</span>: <span class="name">x</span>; <span class="name">control1Y</span>: <span class="number">50</span>
<span class="name">control2X</span>: <span class="number">50</span>; <span class="name">control2Y</span>: <span class="name">y</span>
}
<span class="name">onChanged</span>: <span class="name">canvas</span>.<span class="name">requestPaint</span>()
}
}</pre>
<p><a href="qml-qtquick-pathinterpolator.html">PathInterpolator</a> animates an image along the same beizer curve, using a <a href="qml-qtquick-pathinterpolator.html">PathInterpolator</a> instead.</p>
<pre class="qml"><span class="type"><a href="qml-qtquick-pathinterpolator.html">PathInterpolator</a></span> {
<span class="name">id</span>: <span class="name">motionPath</span>
<span class="name">path</span>: <span class="name">Path</span> {
<span class="name">startX</span>: <span class="number">50</span>; <span class="name">startY</span>: <span class="number">50</span>
<span class="type"><a href="qml-qtquick-pathcubic.html">PathCubic</a></span> {
<span class="name">x</span>: <span class="name">window</span>.<span class="name">width</span> <span class="operator">-</span> <span class="number">50</span>
<span class="name">y</span>: <span class="name">window</span>.<span class="name">height</span> <span class="operator">-</span> <span class="number">50</span>
<span class="name">control1X</span>: <span class="name">x</span>; <span class="name">control1Y</span>: <span class="number">50</span>
<span class="name">control2X</span>: <span class="number">50</span>; <span class="name">control2Y</span>: <span class="name">y</span>
}
<span class="name">onChanged</span>: <span class="name">canvas</span>.<span class="name">requestPaint</span>()
}
SequentialAnimation on <span class="name">progress</span> {
<span class="name">running</span>: <span class="number">true</span>
<span class="name">loops</span>: -<span class="number">1</span>
<span class="type"><a href="qml-qtquick-pauseanimation.html">PauseAnimation</a></span> { <span class="name">duration</span>: <span class="number">1000</span> }
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {
<span class="name">id</span>: <span class="name">progressAnim</span>
<span class="name">running</span>: <span class="number">false</span>
<span class="name">from</span>: <span class="number">0</span>; <span class="name">to</span>: <span class="number">1</span>
<span class="name">duration</span>: <span class="number">2000</span>
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InQuad</span>
}
}
}</pre>
<p>Files:</p>
<ul>
<li><a href="qtquick-animation-animation-qml.html">animation/animation.qml</a></li>
<li><a href="qtquick-animation-basics-animators-qml.html">animation/basics/animators.qml</a></li>
<li><a href="qtquick-animation-basics-color-animation-qml.html">animation/basics/color-animation.qml</a></li>
<li><a href="qtquick-animation-basics-property-animation-qml.html">animation/basics/property-animation.qml</a></li>
<li><a href="qtquick-animation-behaviors-siderect-qml.html">animation/behaviors/SideRect.qml</a></li>
<li><a href="qtquick-animation-behaviors-behavior-example-qml.html">animation/behaviors/behavior-example.qml</a></li>
<li><a href="qtquick-animation-behaviors-tvtennis-qml.html">animation/behaviors/tvtennis.qml</a></li>
<li><a href="qtquick-animation-behaviors-wigglytext-qml.html">animation/behaviors/wigglytext.qml</a></li>
<li><a href="qtquick-animation-easing-easing-qml.html">animation/easing/easing.qml</a></li>
<li><a href="qtquick-animation-pathanimation-pathanimation-qml.html">animation/pathanimation/pathanimation.qml</a></li>
<li><a href="qtquick-animation-pathinterpolator-pathinterpolator-qml.html">animation/pathinterpolator/pathinterpolator.qml</a></li>
<li><a href="qtquick-animation-states-states-qml.html">animation/states/states.qml</a></li>
<li><a href="qtquick-animation-states-transitions-qml.html">animation/states/transitions.qml</a></li>
<li><a href="qtquick-animation-main-cpp.html">animation/main.cpp</a></li>
<li><a href="qtquick-animation-animation-pro.html">animation/animation.pro</a></li>
<li><a href="qtquick-animation-animation-qmlproject.html">animation/animation.qmlproject</a></li>
<li><a href="qtquick-animation-animation-qrc.html">animation/animation.qrc</a></li>
</ul>
</div>
<!-- @@@animation -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.<br> 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.<br> 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. </p>
</div>
</body>
</html>
|