<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qquickitemanimation.cpp --> <title>AnchorAnimation QML Type | Qt Quick 5.12.6</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.12</td><td ><a href="qtquick-index.html">Qt Quick</a></td><td ><a href="qtquick-qmlmodule.html">QML Types</a></td><td >AnchorAnimation QML Type</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.6 Reference Documentation</a></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">AnchorAnimation QML Type</h1> <span class="subtitle"></span> <!-- $$$AnchorAnimation-brief --> <p>Animates changes in anchor values. <a href="#details">More...</a></p> <!-- @@@AnchorAnimation --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.12</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></table></div><ul> <li><a href="qml-qtquick-anchoranimation-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-anchoranimation.html#duration-prop">duration</a></b></b> : int</li> <li class="fn"><b><b><a href="qml-qtquick-anchoranimation.html#easing-prop">easing</a></b></b><ul> <li class="fn"><b><b><a href="qml-qtquick-anchoranimation.html#easing.type-prop">easing.type</a></b></b> : enumeration</li> <li class="fn"><b><b><a href="qml-qtquick-anchoranimation.html#easing.amplitude-prop">easing.amplitude</a></b></b> : real</li> <li class="fn"><b><b><a href="qml-qtquick-anchoranimation.html#easing.overshoot-prop">easing.overshoot</a></b></b> : real</li> <li class="fn"><b><b><a href="qml-qtquick-anchoranimation.html#easing.period-prop">easing.period</a></b></b> : real</li> </ul> </li> <li class="fn"><b><b><a href="qml-qtquick-anchoranimation.html#targets-prop">targets</a></b></b> : list<Item></li> </ul> <!-- $$$AnchorAnimation-description --> <a name="details"></a> <h2 id="details">Detailed Description</h2> <p><a href="qml-qtquick-anchoranimation.html">AnchorAnimation</a> is used to animate an anchor change.</p> <p>In the following snippet we animate the addition of a right anchor to a <a href="qml-qtquick-rectangle.html">Rectangle</a>:</p> <pre class="qml"> import QtQuick 2.0 Item { id: container width: 200; height: 200 Rectangle { id: myRect width: 100; height: 100 color: "red" } states: State { name: "reanchored" AnchorChanges { target: myRect; anchors.right: container.right } } transitions: Transition { // smoothly reanchor myRect and move into new position AnchorAnimation { duration: 1000 } } Component.onCompleted: container.state = "reanchored" } </pre> <p>When an <a href="qml-qtquick-anchoranimation.html">AnchorAnimation</a> is used in a <a href="qmlexampletoggleswitch.html#transition">Transition</a>, it will animate any <a href="qml-qtquick-anchorchanges.html">AnchorChanges</a> that have occurred during the state change. This can be overridden by setting a specific target item using the <a href="qml-qtquick-anchorchanges.html#target-prop">AnchorChanges.target</a> property.</p> <p><b>Note: </b><a href="qml-qtquick-anchoranimation.html">AnchorAnimation</a> can only be used in a <a href="qmlexampletoggleswitch.html#transition">Transition</a> and in conjunction with an AnchorChange. It cannot be used in behaviors and other types of animations.</p><p><b>See also </b><a href="qtquick-statesanimations-animations.html">Animation and Transitions in Qt Quick</a> and <a href="qml-qtquick-anchorchanges.html">AnchorChanges</a>.</p> <!-- @@@AnchorAnimation --> <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></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. The default easing curve is Linear.</p> <pre class="qml"> </pre> <p>See the <a href="qml-qtquick-propertyanimation.html#easing.type-prop">PropertyAnimation::easing.type</a> documentation for information about the different types of easing curves.</p> </div></div><!-- @@@easing --> <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"><a href="qml-qtquick-item.html">Item</a></span>></p></td></tr> </table></div> </div><div class="qmldoc"><p>The items to reanchor.</p> <p>If no targets are specified all <a href="qml-qtquick-anchorchanges.html">AnchorChanges</a> will be animated by the <a href="qml-qtquick-anchoranimation.html">AnchorAnimation</a>.</p> </div></div><!-- @@@targets --> <br/> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 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>