/usr/share/qt5/doc/qtquick/qml-qtquick-propertyanimation.html is in qtdeclarative5-doc-html 5.9.5-0ubuntu1.
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 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickanimation.cpp -->
<title>PropertyAnimation QML Type | Qt Quick 5.9</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
// loading style sheet breaks anchors that were jumped to before
// so force jumping to anchor again
setTimeout(function() {
var anchor = location.hash;
// need to jump to different anchor first (e.g. none)
location.hash = "#";
setTimeout(function() {
location.hash = anchor;
}, 0);
}, 0);
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td >Qt 5.9</td><td ><a href="qtquick-index.html">Qt Quick</a></td><td ><a href="qtquick-qmlmodule.html">QML Types</a></td><td >PropertyAnimation QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 Reference Documentation</td>
</tr></table>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">PropertyAnimation QML Type</h1>
<span class="subtitle"></span>
<!-- $$$PropertyAnimation-brief -->
<p>Animates changes in property values <a href="#details">More...</a></p>
<!-- @@@PropertyAnimation -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.7</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-animation.html">Animation</a></p>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-coloranimation.html">ColorAnimation</a>, <a href="qml-qtquick-numberanimation.html">NumberAnimation</a>, <a href="qml-qtquick-rotationanimation.html">RotationAnimation</a>, and <a href="qml-qtquick-vector3danimation.html">Vector3dAnimation</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-propertyanimation-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#duration-prop">duration</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing-prop">easing</a></b></b><ul>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.type-prop">easing.type</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.amplitude-prop">easing.amplitude</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.overshoot-prop">easing.overshoot</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.period-prop">easing.period</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#easing.bezierCurve-prop">easing.bezierCurve</a></b></b> : list<real></li>
</ul>
</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a></b></b> : list<Object></li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#from-prop">from</a></b></b> : variant</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#properties-prop">properties</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#property-prop">property</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#target-prop">target</a></b></b> : Object</li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#targets-prop">targets</a></b></b> : list<Object></li>
<li class="fn"><b><b><a href="qml-qtquick-propertyanimation.html#to-prop">to</a></b></b> : variant</li>
</ul>
<!-- $$$PropertyAnimation-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p><a href="qtquick-animation-example.html#propertyanimation">PropertyAnimation</a> provides a way to animate changes to a property's value.</p>
<p>It can be used to define animations in a number of ways:</p>
<ul>
<li>In a <a href="qmlexampletoggleswitch.html#transition">Transition</a><p>For example, to animate any objects that have changed their <code>x</code> or <code>y</code> properties as a result of a state change, using an <code>InOutQuad</code> easing curve:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">rect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="string">"red"</span>
<span class="name">states</span>: <span class="name">State</span> {
<span class="name">name</span>: <span class="string">"moved"</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">rect</span>; <span class="name">x</span>: <span class="number">50</span> }
}
<span class="name">transitions</span>: <span class="name">Transition</span> {
<span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</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> }
}
}
</pre>
</li>
<li>In a <a href="qml-qtquick-behavior.html">Behavior</a><p>For example, to animate all changes to a rectangle's <code>x</code> property:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="string">"red"</span>
Behavior on <span class="name">x</span> { <span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> {} }
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> { <span class="name">anchors</span>.fill: <span class="name">parent</span>; <span class="name">onClicked</span>: <span class="name">parent</span>.<span class="name">x</span> <span class="operator">=</span> <span class="number">50</span> }
}
</pre>
</li>
<li>As a property value source<p>For example, to repeatedly animate the rectangle's <code>x</code> property:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="string">"red"</span>
SequentialAnimation on <span class="name">x</span> {
<span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span>
<span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> { <span class="name">to</span>: <span class="number">50</span> }
<span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> { <span class="name">to</span>: <span class="number">0</span> }
}
}
</pre>
</li>
<li>In a signal handler<p>For example, to fade out <code>theObject</code> when clicked:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">anchors</span>.fill: <span class="name">theObject</span>
<span class="name">onClicked</span>: <span class="name">PropertyAnimation</span> { <span class="name">target</span>: <span class="name">theObject</span>; <span class="name">property</span>: <span class="string">"opacity"</span>; <span class="name">to</span>: <span class="number">0</span> }
}
</pre>
</li>
<li>Standalone<p>For example, to animate <code>rect</code>'s <code>width</code> property over 500ms, from its current width to 30:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="string">"red"</span>
<span class="comment">// this is a standalone animation, it's not running by default</span>
<span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> { <span class="name">id</span>: <span class="name">animation</span>;
<span class="name">target</span>: <span class="name">theRect</span>;
<span class="name">property</span>: <span class="string">"width"</span>;
<span class="name">to</span>: <span class="number">30</span>;
<span class="name">duration</span>: <span class="number">500</span> }
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> { <span class="name">anchors</span>.fill: <span class="name">parent</span>; <span class="name">onClicked</span>: <span class="name">animation</span>.<span class="name">running</span> <span class="operator">=</span> <span class="number">true</span> }
}
</pre>
</li>
</ul>
<p>Depending on how the animation is used, the set of properties normally used will be different. For more information see the individual property documentation, as well as the <a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a> introduction.</p>
<p>Note that <a href="qtquick-animation-example.html#propertyanimation">PropertyAnimation</a> inherits the abstract <a href="qml-qtquick-animation.html">Animation</a> type. This includes additional properties and methods for controlling the animation.</p>
<p><b>See also </b><a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a> and <a href="qtquick-animation-example.html">Qt Quick Examples - Animation</a>.</p>
<!-- @@@PropertyAnimation -->
<h2>Property Documentation</h2>
<!-- $$$duration -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="duration-prop">
<td class="tblQmlPropNode"><p>
<a name="duration-prop"></a><span class="name">duration</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the duration of the animation, in milliseconds.</p>
<p>The default value is 250.</p>
</div></div><!-- @@@duration -->
<br/>
<!-- $$$easing -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="even" id="easing-prop"><th class="centerAlign"><p><a name="easing-prop"></a><b>easing group</b></p></th></tr><tr valign="top" class="odd" id="easing.type-prop"><td class="tblQmlPropNode"><p><a name="easing.type-prop"></a><span class="name">easing.type</span> : <span class="type">enumeration</span></p></td></tr><tr valign="top" class="odd" id="easing.amplitude-prop"><td class="tblQmlPropNode"><p><a name="easing.amplitude-prop"></a><span class="name">easing.amplitude</span> : <span class="type">real</span></p></td></tr><tr valign="top" class="odd" id="easing.overshoot-prop"><td class="tblQmlPropNode"><p><a name="easing.overshoot-prop"></a><span class="name">easing.overshoot</span> : <span class="type">real</span></p></td></tr><tr valign="top" class="odd" id="easing.period-prop"><td class="tblQmlPropNode"><p><a name="easing.period-prop"></a><span class="name">easing.period</span> : <span class="type">real</span></p></td></tr><tr valign="top" class="odd" id="easing.bezierCurve-prop"><td class="tblQmlPropNode"><p><a name="easing.bezierCurve-prop"></a><span class="name">easing.bezierCurve</span> : <span class="type">list</span><<span class="type">real</span>></p></td></tr></table></div></div><div class="qmldoc"><p>Specifies the easing curve used for the animation</p>
<p>To specify an easing curve you need to specify at least the type. For some curves you can also specify amplitude, period and/or overshoot (more details provided after the table). The default easing curve is <code>Easing.Linear</code>.</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-propertyanimation.html">PropertyAnimation</a></span> { <span class="name">properties</span>: <span class="string">"y"</span>;
<span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">InOutElastic</span>;
<span class="name">easing</span>.amplitude: <span class="number">2.0</span>;
<span class="name">easing</span>.period: <span class="number">1.5</span> }
</pre>
<p>Available types are:</p>
<div class="table"><table class="generic">
<tr valign="top" class="odd"><td ><code>Easing.Linear</code></td><td >Easing curve for a linear (t) function: velocity is constant.</td><td ><img src="images/qeasingcurve-linear.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InQuad</code></td><td >Easing curve for a quadratic (t^2) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inquad.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutQuad</code></td><td >Easing curve for a quadratic (t^2) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outquad.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutQuad</code></td><td >Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutquad.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInQuad</code></td><td >Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinquad.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InCubic</code></td><td >Easing curve for a cubic (t^3) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-incubic.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutCubic</code></td><td >Easing curve for a cubic (t^3) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outcubic.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutCubic</code></td><td >Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutcubic.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInCubic</code></td><td >Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outincubic.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InQuart</code></td><td >Easing curve for a quartic (t^4) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inquart.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutQuart</code></td><td >Easing curve for a quartic (t^4) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outquart.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutQuart</code></td><td >Easing curve for a quartic (t^4) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutquart.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInQuart</code></td><td >Easing curve for a quartic (t^4) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinquart.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InQuint</code></td><td >Easing curve for a quintic (t^5) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inquint.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutQuint</code></td><td >Easing curve for a quintic (t^5) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outquint.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutQuint</code></td><td >Easing curve for a quintic (t^5) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutquint.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInQuint</code></td><td >Easing curve for a quintic (t^5) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinquint.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InSine</code></td><td >Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-insine.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutSine</code></td><td >Easing curve for a sinusoidal (sin(t)) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outsine.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutSine</code></td><td >Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutsine.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInSine</code></td><td >Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinsine.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InExpo</code></td><td >Easing curve for an exponential (2^t) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inexpo.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutExpo</code></td><td >Easing curve for an exponential (2^t) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outexpo.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutExpo</code></td><td >Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutexpo.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInExpo</code></td><td >Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinexpo.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InCirc</code></td><td >Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-incirc.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutCirc</code></td><td >Easing curve for a circular (sqrt(1-t^2)) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outcirc.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutCirc</code></td><td >Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutcirc.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInCirc</code></td><td >Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outincirc.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InElastic</code></td><td >Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity. <br />
The peak amplitude can be set with the <i>amplitude</i> parameter, and the period of decay by the <i>period</i> parameter.</td><td ><img src="images/qeasingcurve-inelastic.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutElastic</code></td><td >Easing curve for an elastic (exponentially decaying sine wave) function: decelerating to zero velocity. <br />
The peak amplitude can be set with the <i>amplitude</i> parameter, and the period of decay by the <i>period</i> parameter.</td><td ><img src="images/qeasingcurve-outelastic.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutElastic</code></td><td >Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutelastic.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInElastic</code></td><td >Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinelastic.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InBack</code></td><td >Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inback.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutBack</code></td><td >Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outback.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutBack</code></td><td >Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutback.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInBack</code></td><td >Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinback.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InBounce</code></td><td >Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity.</td><td ><img src="images/qeasingcurve-inbounce.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutBounce</code></td><td >Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating to zero velocity.</td><td ><img src="images/qeasingcurve-outbounce.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.InOutBounce</code></td><td >Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration.</td><td ><img src="images/qeasingcurve-inoutbounce.png" alt="" /></td></tr>
<tr valign="top" class="odd"><td ><code>Easing.OutInBounce</code></td><td >Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration.</td><td ><img src="images/qeasingcurve-outinbounce.png" alt="" /></td></tr>
<tr valign="top" class="even"><td ><code>Easing.Bezier</code></td><td >Custom easing curve defined by the easing.bezierCurve property.</td><td ></td></tr>
</table></div>
<p><code>easing.amplitude</code> is only applicable for bounce and elastic curves (curves of type <code>Easing.InBounce</code>, <code>Easing.OutBounce</code>, <code>Easing.InOutBounce</code>, <code>Easing.OutInBounce</code>, <code>Easing.InElastic</code>, <code>Easing.OutElastic</code>, <code>Easing.InOutElastic</code> or <code>Easing.OutInElastic</code>).</p>
<p><code>easing.overshoot</code> is only applicable if <code>easing.type</code> is: <code>Easing.InBack</code>, <code>Easing.OutBack</code>, <code>Easing.InOutBack</code> or <code>Easing.OutInBack</code>.</p>
<p><code>easing.period</code> is only applicable if easing.type is: <code>Easing.InElastic</code>, <code>Easing.OutElastic</code>, <code>Easing.InOutElastic</code> or <code>Easing.OutInElastic</code>.</p>
<p><code>easing.bezierCurve</code> is only applicable if easing.type is: <code>Easing.Bezier</code>. This property is a list<real> containing groups of three points defining a curve from 0,0 to 1,1 - control1, control2, end point: [cx1, cy1, cx2, cy2, endx, endy, ...]. The last point must be 1,1.</p>
<p>See the <a href="qtquick-animation-example.html#easing-curves">Easing Curves</a> for a demonstration of the different easing settings.</p>
</div></div><!-- @@@easing -->
<br/>
<!-- $$$exclude -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="exclude-prop">
<td class="tblQmlPropNode"><p>
<a name="exclude-prop"></a><span class="name">exclude</span> : <span class="type">list</span><<span class="type">Object</span>></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the items not to be affected by this animation.</p>
<p><b>See also </b><a href="qml-qtquick-propertyanimation.html#targets-prop">PropertyAnimation::targets</a>.</p>
</div></div><!-- @@@exclude -->
<br/>
<!-- $$$from -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="from-prop">
<td class="tblQmlPropNode"><p>
<a name="from-prop"></a><span class="name">from</span> : <span class="type">variant</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the starting value for the animation.</p>
<p>If the <a href="qtquick-animation-example.html#propertyanimation">PropertyAnimation</a> is defined within a <a href="qmlexampletoggleswitch.html#transition">Transition</a> or <a href="qml-qtquick-behavior.html">Behavior</a>, this value defaults to the value defined in the starting state of the <a href="qmlexampletoggleswitch.html#transition">Transition</a>, or the current value of the property at the moment the <a href="qml-qtquick-behavior.html">Behavior</a> is triggered.</p>
<p><b>See also </b><a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a>.</p>
</div></div><!-- @@@from -->
<br/>
<!-- $$$properties -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="properties-prop">
<td class="tblQmlPropNode"><p>
<a name="properties-prop"></a><span class="name">properties</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g.</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theItem</span>; <span class="name">property</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>has the same meaning as</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: <span class="name">theItem</span>; <span class="name">properties</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>The singular forms are slightly optimized, so if you do have only a single target/property to animate you should try to use them.</p>
<p>The <code>targets</code> property allows multiple targets to be set. For example, this animates the <code>x</code> property of both <code>itemA</code> and <code>itemB</code>:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: [<span class="name">itemA</span>, <span class="name">itemB</span>]; <span class="name">properties</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>In many cases these properties do not need to be explicitly specified, as they can be inferred from the animation framework:</p>
<div class="table"><table class="generic" width="80%">
<tr valign="top" class="odd"><td >Value Source / Behavior</td><td >When an animation is used as a value source or in a Behavior, the default target and property name to be animated can both be inferred.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
NumberAnimation on <span class="name">x</span> { <span class="name">to</span>: <span class="number">500</span>; <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span> } <span class="comment">//animate theRect's x property</span>
Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {} } <span class="comment">//animate theRect's y property</span>
}
</pre>
</td></tr>
<tr valign="top" class="even"><td >Transition</td><td >When used in a transition, a property animation is assumed to match <i>all</i> targets but <i>no</i> properties. In practice, that means you need to specify at least the properties in order for the animation to do anything.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
<span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">id</span>: <span class="name">uselessItem</span> }
<span class="name">states</span>: <span class="name">State</span> {
<span class="name">name</span>: <span class="string">"state1"</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">x</span>: <span class="number">200</span>; <span class="name">y</span>: <span class="number">200</span>; <span class="name">z</span>: <span class="number">4</span> }
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">uselessItem</span>; <span class="name">x</span>: <span class="number">10</span>; <span class="name">y</span>: <span class="number">10</span>; <span class="name">z</span>: <span class="number">2</span> }
}
<span class="name">transitions</span>: <span class="name">Transition</span> {
<span class="comment">//animate both theRect's and uselessItem's x and y to their final values</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="comment">//animate theRect's z to its final value</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">"z"</span> }
}
}
</pre>
</td></tr>
<tr valign="top" class="odd"><td >Standalone</td><td >When an animation is used standalone, both the target and property need to be explicitly specified.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
<span class="comment">//need to explicitly specify target and property</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">id</span>: <span class="name">theAnim</span>; <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: <span class="name">theAnim</span>.<span class="name">start</span>()
}
}
</pre>
</td></tr>
</table></div>
<p>As seen in the above example, properties is specified as a comma-separated string of property names to animate.</p>
<p><b>See also </b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a> and <a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a>.</p>
</div></div><!-- @@@properties -->
<br/>
<!-- $$$property -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="property-prop">
<td class="tblQmlPropNode"><p>
<a name="property-prop"></a><span class="name">property</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g.</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theItem</span>; <span class="name">property</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>has the same meaning as</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: <span class="name">theItem</span>; <span class="name">properties</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>The singular forms are slightly optimized, so if you do have only a single target/property to animate you should try to use them.</p>
<p>The <code>targets</code> property allows multiple targets to be set. For example, this animates the <code>x</code> property of both <code>itemA</code> and <code>itemB</code>:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: [<span class="name">itemA</span>, <span class="name">itemB</span>]; <span class="name">properties</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>In many cases these properties do not need to be explicitly specified, as they can be inferred from the animation framework:</p>
<div class="table"><table class="generic" width="80%">
<tr valign="top" class="odd"><td >Value Source / Behavior</td><td >When an animation is used as a value source or in a Behavior, the default target and property name to be animated can both be inferred.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
NumberAnimation on <span class="name">x</span> { <span class="name">to</span>: <span class="number">500</span>; <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span> } <span class="comment">//animate theRect's x property</span>
Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {} } <span class="comment">//animate theRect's y property</span>
}
</pre>
</td></tr>
<tr valign="top" class="even"><td >Transition</td><td >When used in a transition, a property animation is assumed to match <i>all</i> targets but <i>no</i> properties. In practice, that means you need to specify at least the properties in order for the animation to do anything.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
<span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">id</span>: <span class="name">uselessItem</span> }
<span class="name">states</span>: <span class="name">State</span> {
<span class="name">name</span>: <span class="string">"state1"</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">x</span>: <span class="number">200</span>; <span class="name">y</span>: <span class="number">200</span>; <span class="name">z</span>: <span class="number">4</span> }
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">uselessItem</span>; <span class="name">x</span>: <span class="number">10</span>; <span class="name">y</span>: <span class="number">10</span>; <span class="name">z</span>: <span class="number">2</span> }
}
<span class="name">transitions</span>: <span class="name">Transition</span> {
<span class="comment">//animate both theRect's and uselessItem's x and y to their final values</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="comment">//animate theRect's z to its final value</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">"z"</span> }
}
}
</pre>
</td></tr>
<tr valign="top" class="odd"><td >Standalone</td><td >When an animation is used standalone, both the target and property need to be explicitly specified.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
<span class="comment">//need to explicitly specify target and property</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">id</span>: <span class="name">theAnim</span>; <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: <span class="name">theAnim</span>.<span class="name">start</span>()
}
}
</pre>
</td></tr>
</table></div>
<p>As seen in the above example, properties is specified as a comma-separated string of property names to animate.</p>
<p><b>See also </b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a> and <a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a>.</p>
</div></div><!-- @@@property -->
<br/>
<!-- $$$target -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="target-prop">
<td class="tblQmlPropNode"><p>
<a name="target-prop"></a><span class="name">target</span> : <span class="type">Object</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g.</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theItem</span>; <span class="name">property</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>has the same meaning as</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: <span class="name">theItem</span>; <span class="name">properties</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>The singular forms are slightly optimized, so if you do have only a single target/property to animate you should try to use them.</p>
<p>The <code>targets</code> property allows multiple targets to be set. For example, this animates the <code>x</code> property of both <code>itemA</code> and <code>itemB</code>:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: [<span class="name">itemA</span>, <span class="name">itemB</span>]; <span class="name">properties</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>In many cases these properties do not need to be explicitly specified, as they can be inferred from the animation framework:</p>
<div class="table"><table class="generic" width="80%">
<tr valign="top" class="odd"><td >Value Source / Behavior</td><td >When an animation is used as a value source or in a Behavior, the default target and property name to be animated can both be inferred.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
NumberAnimation on <span class="name">x</span> { <span class="name">to</span>: <span class="number">500</span>; <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span> } <span class="comment">//animate theRect's x property</span>
Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {} } <span class="comment">//animate theRect's y property</span>
}
</pre>
</td></tr>
<tr valign="top" class="even"><td >Transition</td><td >When used in a transition, a property animation is assumed to match <i>all</i> targets but <i>no</i> properties. In practice, that means you need to specify at least the properties in order for the animation to do anything.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
<span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">id</span>: <span class="name">uselessItem</span> }
<span class="name">states</span>: <span class="name">State</span> {
<span class="name">name</span>: <span class="string">"state1"</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">x</span>: <span class="number">200</span>; <span class="name">y</span>: <span class="number">200</span>; <span class="name">z</span>: <span class="number">4</span> }
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">uselessItem</span>; <span class="name">x</span>: <span class="number">10</span>; <span class="name">y</span>: <span class="number">10</span>; <span class="name">z</span>: <span class="number">2</span> }
}
<span class="name">transitions</span>: <span class="name">Transition</span> {
<span class="comment">//animate both theRect's and uselessItem's x and y to their final values</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="comment">//animate theRect's z to its final value</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">"z"</span> }
}
}
</pre>
</td></tr>
<tr valign="top" class="odd"><td >Standalone</td><td >When an animation is used standalone, both the target and property need to be explicitly specified.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
<span class="comment">//need to explicitly specify target and property</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">id</span>: <span class="name">theAnim</span>; <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: <span class="name">theAnim</span>.<span class="name">start</span>()
}
}
</pre>
</td></tr>
</table></div>
<p>As seen in the above example, properties is specified as a comma-separated string of property names to animate.</p>
<p><b>See also </b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a> and <a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a>.</p>
</div></div><!-- @@@target -->
<br/>
<!-- $$$targets -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="targets-prop">
<td class="tblQmlPropNode"><p>
<a name="targets-prop"></a><span class="name">targets</span> : <span class="type">list</span><<span class="type">Object</span>></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties are used as a set to determine which properties should be animated. The singular and plural forms are functionally identical, e.g.</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theItem</span>; <span class="name">property</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>has the same meaning as</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: <span class="name">theItem</span>; <span class="name">properties</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>The singular forms are slightly optimized, so if you do have only a single target/property to animate you should try to use them.</p>
<p>The <code>targets</code> property allows multiple targets to be set. For example, this animates the <code>x</code> property of both <code>itemA</code> and <code>itemB</code>:</p>
<pre class="qml">
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">targets</span>: [<span class="name">itemA</span>, <span class="name">itemB</span>]; <span class="name">properties</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
</pre>
<p>In many cases these properties do not need to be explicitly specified, as they can be inferred from the animation framework:</p>
<div class="table"><table class="generic" width="80%">
<tr valign="top" class="odd"><td >Value Source / Behavior</td><td >When an animation is used as a value source or in a Behavior, the default target and property name to be animated can both be inferred.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
NumberAnimation on <span class="name">x</span> { <span class="name">to</span>: <span class="number">500</span>; <span class="name">loops</span>: <span class="name">Animation</span>.<span class="name">Infinite</span> } <span class="comment">//animate theRect's x property</span>
Behavior on <span class="name">y</span> { <span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> {} } <span class="comment">//animate theRect's y property</span>
}
</pre>
</td></tr>
<tr valign="top" class="even"><td >Transition</td><td >When used in a transition, a property animation is assumed to match <i>all</i> targets but <i>no</i> properties. In practice, that means you need to specify at least the properties in order for the animation to do anything.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
<span class="type"><a href="qml-qtquick-item.html">Item</a></span> { <span class="name">id</span>: <span class="name">uselessItem</span> }
<span class="name">states</span>: <span class="name">State</span> {
<span class="name">name</span>: <span class="string">"state1"</span>
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">x</span>: <span class="number">200</span>; <span class="name">y</span>: <span class="number">200</span>; <span class="name">z</span>: <span class="number">4</span> }
<span class="type"><a href="qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">uselessItem</span>; <span class="name">x</span>: <span class="number">10</span>; <span class="name">y</span>: <span class="number">10</span>; <span class="name">z</span>: <span class="number">2</span> }
}
<span class="name">transitions</span>: <span class="name">Transition</span> {
<span class="comment">//animate both theRect's and uselessItem's x and y to their final values</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="comment">//animate theRect's z to its final value</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">"z"</span> }
}
}
</pre>
</td></tr>
<tr valign="top" class="odd"><td >Standalone</td><td >When an animation is used standalone, both the target and property need to be explicitly specified.<pre class="qml">
<span class="type"><a href="qml-qtquick-rectangle.html">Rectangle</a></span> {
<span class="name">id</span>: <span class="name">theRect</span>
<span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
<span class="name">color</span>: <span class="name">Qt</span>.<span class="name">rgba</span>(<span class="number">0</span>,<span class="number">0</span>,<span class="number">1</span>)
<span class="comment">//need to explicitly specify target and property</span>
<span class="type"><a href="qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">id</span>: <span class="name">theAnim</span>; <span class="name">target</span>: <span class="name">theRect</span>; <span class="name">property</span>: <span class="string">"x"</span>; <span class="name">to</span>: <span class="number">500</span> }
<span class="type"><a href="qml-qtquick-mousearea.html">MouseArea</a></span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: <span class="name">theAnim</span>.<span class="name">start</span>()
}
}
</pre>
</td></tr>
</table></div>
<p>As seen in the above example, properties is specified as a comma-separated string of property names to animate.</p>
<p><b>See also </b><a href="qml-qtquick-propertyanimation.html#exclude-prop">exclude</a> and <a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a>.</p>
</div></div><!-- @@@targets -->
<br/>
<!-- $$$to -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="to-prop">
<td class="tblQmlPropNode"><p>
<a name="to-prop"></a><span class="name">to</span> : <span class="type">variant</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the end value for the animation.</p>
<p>If the <a href="qtquick-animation-example.html#propertyanimation">PropertyAnimation</a> is defined within a <a href="qmlexampletoggleswitch.html#transition">Transition</a> or <a href="qml-qtquick-behavior.html">Behavior</a>, this value defaults to the value defined in the end state of the <a href="qmlexampletoggleswitch.html#transition">Transition</a>, or the value of the property change that triggered the <a href="qml-qtquick-behavior.html">Behavior</a>.</p>
<p><b>See also </b><a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a>.</p>
</div></div><!-- @@@to -->
<br/>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd.
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> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|