Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > 6e2327ca1c896c6d674ae53117299f21 > files > 876

qtdeclarative5-doc-5.12.6-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickanimatedsprite.cpp -->
  <title>AnimatedSprite 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 >AnimatedSprite 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="#signals">Signals</a></li>
<li class="level1"><a href="#methods">Methods</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">AnimatedSprite QML Type</h1>
<span class="subtitle"></span>
<!-- $$$AnimatedSprite-brief -->
<p>Draws a sprite animation. <a href="#details">More...</a></p>
<!-- @@@AnimatedSprite -->
<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-item.html">Item</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-animatedsprite-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-animatedsprite.html#currentFrame-prop">currentFrame</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#frameCount-prop">frameCount</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#frameDuration-prop">frameDuration</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#frameHeight-prop">frameHeight</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#frameRate-prop">frameRate</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#frameSync-prop">frameSync</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#frameWidth-prop">frameWidth</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#frameX-prop">frameX</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#frameY-prop">frameY</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#interpolate-prop">interpolate</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#loops-prop">loops</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#paused-prop">paused</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#reverse-prop">reverse</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#running-prop">running</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#source-prop">source</a></b></b> : url</li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-animatedsprite.html#finished-signal">finished</a></b></b>()</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">int <b><b><a href="qml-qtquick-animatedsprite.html#advance-method">advance</a></b></b>()</li>
<li class="fn">int <b><b><a href="qml-qtquick-animatedsprite.html#pause-method">pause</a></b></b>()</li>
<li class="fn">int <b><b><a href="qml-qtquick-animatedsprite.html#restart-method">restart</a></b></b>()</li>
<li class="fn">int <b><b><a href="qml-qtquick-animatedsprite.html#resume-method">resume</a></b></b>()</li>
</ul>
<!-- $$$AnimatedSprite-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p><a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a> provides rendering and control over animations which are provided as multiple frames in the same image file. You can play it at a fixed speed, at the frame rate of your display, or manually advance and control the progress.</p>
<p>Consider the following sprite sheet:</p>
<p class="centerAlign"><img src="images/animatedsprite-loading.png" alt="" /></p><p>It can be divided up into four frames:</p>
<p class="centerAlign"><img src="images/animatedsprite-loading-frames.png" alt="" /></p><p>To play each of these frames at a speed of 500 milliseconds per frame, the following code can be used:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Code</th><th >Result</th></tr></thead>
<tr valign="top" class="odd"><td ><pre class="cpp">

  AnimatedSprite {
      source: <span class="string">&quot;loading.png&quot;</span>
      frameWidth: <span class="number">64</span>
      frameHeight: <span class="number">64</span>
      frameCount: <span class="number">4</span>
      frameDuration: <span class="number">500</span>
  }

</pre>
</td><td ><p class="centerAlign"><img src="images/animatedsprite-loading-interpolated.gif" alt="" /></p></td></tr>
</table></div>
<p>By default, the frames are interpolated (blended together) to make the animation appear smoother. To disable this, set <a href="qml-qtquick-animatedsprite.html#interpolate-prop">interpolate</a> to <code>false</code>:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Code</th><th >Result</th></tr></thead>
<tr valign="top" class="odd"><td ><pre class="cpp">

  AnimatedSprite {
      source: <span class="string">&quot;loading.png&quot;</span>
      frameWidth: <span class="number">64</span>
      frameHeight: <span class="number">64</span>
      frameCount: <span class="number">4</span>
      frameDuration: <span class="number">500</span>
      interpolate: <span class="keyword">false</span>
  }

</pre>
</td><td ><p class="centerAlign"><img src="images/animatedsprite-loading.gif" alt="" /></p></td></tr>
</table></div>
<p>To control how <a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a> responds to being scaled, use the <a href="qml-qtquick-item.html#smooth-prop">smooth</a> property.</p>
<p>Note that unlike <a href="qml-qtquick-spritesequence.html">SpriteSequence</a>, the <a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a> type does not use <a href="qml-qtquick-sprite.html">Sprite</a> to define multiple animations, but instead encapsulates a single animation itself.</p>
<p><b>See also </b><a href="qtquick-effects-sprites.html">Sprite Animations</a>.</p>
<!-- @@@AnimatedSprite -->
<h2>Property Documentation</h2>
<!-- $$$currentFrame -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="currentFrame-prop">
<td class="tblQmlPropNode"><p>
<a name="currentFrame-prop"></a><span class="name">currentFrame</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>When paused, the current frame can be advanced manually by setting this property or calling <a href="qml-qtquick-animatedsprite.html#advance-method">advance()</a>.</p>
</div></div><!-- @@@currentFrame -->
<br/>
<!-- $$$frameCount -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameCount-prop">
<td class="tblQmlPropNode"><p>
<a name="frameCount-prop"></a><span class="name">frameCount</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Number of frames in this <a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a>.</p>
</div></div><!-- @@@frameCount -->
<br/>
<!-- $$$frameDuration -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameDuration-prop">
<td class="tblQmlPropNode"><p>
<a name="frameDuration-prop"></a><span class="name">frameDuration</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Duration of each frame of the animation in milliseconds. Values less than or equal to <code>0</code> are invalid.</p>
<p>If <a href="qml-qtquick-animatedsprite.html#frameRate-prop">frameRate</a> is valid, it will be used to calculate the duration of the frames. If not, and frameDuration is valid, <code>frameDuration</code> will be used.</p>
<p>Changing this parameter will restart the animation.</p>
</div></div><!-- @@@frameDuration -->
<br/>
<!-- $$$frameHeight -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameHeight-prop">
<td class="tblQmlPropNode"><p>
<a name="frameHeight-prop"></a><span class="name">frameHeight</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Height of a single frame in this <a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a>.</p>
<p>May be omitted if it is the only sprite in the file.</p>
</div></div><!-- @@@frameHeight -->
<br/>
<!-- $$$frameRate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameRate-prop">
<td class="tblQmlPropNode"><p>
<a name="frameRate-prop"></a><span class="name">frameRate</span> : <span class="type">qreal</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Frames per second to show in the animation. Values less than or equal to <code>0</code> are invalid.</p>
<p>If <code>frameRate</code> is valid, it will be used to calculate the duration of the frames. If not, and <a href="qml-qtquick-animatedsprite.html#frameDuration-prop">frameDuration</a> is valid, <code>frameDuration</code> will be used.</p>
<p>Changing this parameter will restart the animation.</p>
</div></div><!-- @@@frameRate -->
<br/>
<!-- $$$frameSync -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameSync-prop">
<td class="tblQmlPropNode"><p>
<a name="frameSync-prop"></a><span class="name">frameSync</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If <code>true</code>, the animation will have no duration. Instead, the animation will advance one frame each time a frame is rendered to the screen. This synchronizes it with the painting rate as opposed to elapsed time.</p>
<p>If frameSync is set to true, it overrides both <a href="qml-qtquick-animatedsprite.html#frameRate-prop">frameRate</a> and <a href="qml-qtquick-animatedsprite.html#frameDuration-prop">frameDuration</a>.</p>
<p>Default is <code>false</code>.</p>
<p>Changing this parameter will restart the animation.</p>
</div></div><!-- @@@frameSync -->
<br/>
<!-- $$$frameWidth -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameWidth-prop">
<td class="tblQmlPropNode"><p>
<a name="frameWidth-prop"></a><span class="name">frameWidth</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Width of a single frame in this <a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a>.</p>
<p>May be omitted if it is the only sprite in the file.</p>
</div></div><!-- @@@frameWidth -->
<br/>
<!-- $$$frameX -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameX-prop">
<td class="tblQmlPropNode"><p>
<a name="frameX-prop"></a><span class="name">frameX</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The X coordinate in the image file of the first frame of the <a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a>.</p>
<p>May be omitted if the first frame starts in the upper left corner of the file.</p>
</div></div><!-- @@@frameX -->
<br/>
<!-- $$$frameY -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="frameY-prop">
<td class="tblQmlPropNode"><p>
<a name="frameY-prop"></a><span class="name">frameY</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The Y coordinate in the image file of the first frame of the <a href="qml-qtquick-animatedsprite.html">AnimatedSprite</a>.</p>
<p>May be omitted if the first frame starts in the upper left corner of the file.</p>
</div></div><!-- @@@frameY -->
<br/>
<!-- $$$interpolate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="interpolate-prop">
<td class="tblQmlPropNode"><p>
<a name="interpolate-prop"></a><span class="name">interpolate</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If true, interpolation will occur between sprite frames to make the animation appear smoother.</p>
<p>Default is true.</p>
</div></div><!-- @@@interpolate -->
<br/>
<!-- $$$loops -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="loops-prop">
<td class="tblQmlPropNode"><p>
<a name="loops-prop"></a><span class="name">loops</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>After playing the animation this many times, the animation will automatically stop. Negative values are invalid.</p>
<p>If this is set to <code>AnimatedSprite.Infinite</code> the animation will not stop playing on its own.</p>
<p>Default is <code>AnimatedSprite.Infinite</code></p>
</div></div><!-- @@@loops -->
<br/>
<!-- $$$paused -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="paused-prop">
<td class="tblQmlPropNode"><p>
<a name="paused-prop"></a><span class="name">paused</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>When paused, the current frame can be advanced manually.</p>
<p>Default is <code>false</code>.</p>
</div></div><!-- @@@paused -->
<br/>
<!-- $$$reverse -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="reverse-prop">
<td class="tblQmlPropNode"><p>
<a name="reverse-prop"></a><span class="name">reverse</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If <code>true</code>, the animation will be played in reverse.</p>
<p>Default is <code>false</code>.</p>
</div></div><!-- @@@reverse -->
<br/>
<!-- $$$running -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="running-prop">
<td class="tblQmlPropNode"><p>
<a name="running-prop"></a><span class="name">running</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Whether the sprite is animating or not.</p>
<p>Default is true</p>
</div></div><!-- @@@running -->
<br/>
<!-- $$$source -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="source-prop">
<td class="tblQmlPropNode"><p>
<a name="source-prop"></a><span class="name">source</span> : <span class="type">url</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The image source for the animation.</p>
<p>If <a href="qml-qtquick-animatedsprite.html#frameHeight-prop">frameHeight</a> and <a href="qml-qtquick-animatedsprite.html#frameWidth-prop">frameWidth</a> are not specified, it is assumed to be a single long row of square frames. Otherwise, it can be multiple contiguous rows or rectangluar frames, when one row runs out the next will be used.</p>
<p>If <a href="qml-qtquick-animatedsprite.html#frameX-prop">frameX</a> and <a href="qml-qtquick-animatedsprite.html#frameY-prop">frameY</a> are specified, the row of frames will be taken with that x/y coordinate as the upper left corner.</p>
</div></div><!-- @@@source -->
<br/>
<h2>Signal Documentation</h2>
<!-- $$$finished -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="finished-signal">
<td class="tblQmlFuncNode"><p>
<a name="finished-signal"></a><span class="name">finished</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when the sprite has finished animating.</p>
<p>It is not emitted when running is set to <code>false</code>, nor for sprites whose <a href="qml-qtquick-animatedsprite.html#loops-prop">loops</a> property is set to <code>AnimatedSprite.Infinite</code>.</p>
<p>This signal was introduced in  Qt 5.12.</p>
</div></div><!-- @@@finished -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$advance -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="advance-method">
<td class="tblQmlFuncNode"><p>
<a name="advance-method"></a><span class="type">int</span> <span class="name">advance</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Advances the sprite animation by one frame.</p>
</div></div><!-- @@@advance -->
<br/>
<!-- $$$pause -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="pause-method">
<td class="tblQmlFuncNode"><p>
<a name="pause-method"></a><span class="type">int</span> <span class="name">pause</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Pauses the sprite animation. This does nothing if <a href="qml-qtquick-animatedsprite.html#paused-prop">paused</a> is <code>true</code>.</p>
<p><b>See also </b><a href="qml-qtquick-animatedsprite.html#resume-method">resume()</a>.</p>
</div></div><!-- @@@pause -->
<br/>
<!-- $$$restart -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="restart-method">
<td class="tblQmlFuncNode"><p>
<a name="restart-method"></a><span class="type">int</span> <span class="name">restart</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Stops, then starts the sprite animation.</p>
</div></div><!-- @@@restart -->
<br/>
<!-- $$$resume -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="resume-method">
<td class="tblQmlFuncNode"><p>
<a name="resume-method"></a><span class="type">int</span> <span class="name">resume</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Resumes the sprite animation if <a href="qml-qtquick-animatedsprite.html#paused-prop">paused</a> is <code>true</code>; otherwise, this does nothing.</p>
<p><b>See also </b><a href="qml-qtquick-animatedsprite.html#pause-method">pause()</a>.</p>
</div></div><!-- @@@resume -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</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>