<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- imageparticle.qdoc --> <title>Qt Quick Particles Examples - Image Particles | 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 >Qt Quick Particles Examples - Image Particles</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="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">Qt Quick Particles Examples - Image Particles</h1> <span class="subtitle"></span> <!-- $$$particles/imageparticle-brief --> <p>This is a collection of examples using Affectors in the QML particle system.</p> <!-- @@@particles/imageparticle --> <!-- $$$particles/imageparticle-description --> <div class="descr"> <a name="details"></a> <p class="centerAlign"><img src="images/qml-imageparticle-example.png" alt="" /></p><p>This is a collection of small QML examples relating to using Affectors in the particle system. Each example is a small QML file emphasizing a particular type or feature.</p> <p>All at once shows off several of the features of <a href="qml-qtquick-particles-imageparticle.html">ImageParticle</a> at the same time.</p> <pre class="qml"> sprites: [ Sprite { name: "bear" source: "../../images/bear_tiles.png" frameCount: 13 frameDuration: 120 } ] colorVariation: 0.5 rotationVelocityVariation: 360 colorTable: "../../images/colortable.png" </pre> <p>Colored shows a simple <a href="qml-qtquick-particles-imageparticle.html">ImageParticle</a> with some color variation.</p> <pre class="qml"> ImageParticle { anchors.fill: parent source: "qrc:///particleresources/star.png" alpha: 0 alphaVariation: 0.2 colorVariation: 1.0 } </pre> <p>Color Table sets the color over life on the particles to provide a fixed rainbow effect.</p> <pre class="qml"> source: "qrc:///particleresources/glowdot.png" colorTable: "../../images/colortable.png" sizeTable: "../../images/colortable.png" </pre> <p>Deformation spins and squishes a starfish particle.</p> <pre class="qml"> ImageParticle { system: sys groups: ["goingLeft", "goingRight"] source: "../../images/starfish_4.png" rotation: 90 rotationVelocity: 90 autoRotation: true } ImageParticle { system: sys groups: ["goingDown"] source: "../../images/starfish_0.png" rotation: 180 yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; } } </pre> <p>Rotation demonstrates the autoRotate property, so that particles rotate in the direction that they travel.</p> <p>Sharing demonstrates what happens when multiple ImageParticles try to render the same particle. The following <a href="qml-qtquick-particles-imageparticle.html">ImageParticle</a> renders the particles inside the <a href="qml-qtquick-listview.html">ListView</a>:</p> <pre class="qml"> ImageParticle { anchors.fill: parent system: particles source: "../../images/flower.png" alpha: 0.1 color: "white" rotationVariation: 180 z: -1 } </pre> <p>The following <a href="qml-qtquick-particles-imageparticle.html">ImageParticle</a> is placed inside the list highlight, and renders the particles above the other <a href="qml-qtquick-particles-imageparticle.html">ImageParticle</a>.</p> <pre class="qml"> ImageParticle { anchors.fill: parent system: particles source: "../../images/flower.png" color: "red" clip: true alpha: 1.0 } </pre> <p>Note that because it sets the color and alpha in this <a href="qml-qtquick-particles-imageparticle.html">ImageParticle</a>, it renders the particles in a different color. Since it doesn't specify anything about the rotation, it shares the rotation with the other <a href="qml-qtquick-particles-imageparticle.html">ImageParticle</a> so that the flowers are rotated the same way in both. Note that you can undo rotation in another <a href="qml-qtquick-particles-imageparticle.html">ImageParticle</a>, you just need to explicitly set rotationVariation to 0.</p> <p>Sprites demonstrates using an image particle to render animated sprites instead of static images for each particle.</p> <p>Files:</p> <ul> <li><a href="qtquick-particles-imageparticle-content-allatonce-qml.html">particles/imageparticle/content/allatonce.qml</a></li> <li><a href="qtquick-particles-imageparticle-content-colored-qml.html">particles/imageparticle/content/colored.qml</a></li> <li><a href="qtquick-particles-imageparticle-content-colortable-qml.html">particles/imageparticle/content/colortable.qml</a></li> <li><a href="qtquick-particles-imageparticle-content-deformation-qml.html">particles/imageparticle/content/deformation.qml</a></li> <li><a href="qtquick-particles-imageparticle-content-rotation-qml.html">particles/imageparticle/content/rotation.qml</a></li> <li><a href="qtquick-particles-imageparticle-content-sharing-qml.html">particles/imageparticle/content/sharing.qml</a></li> <li><a href="qtquick-particles-imageparticle-content-sprites-qml.html">particles/imageparticle/content/sprites.qml</a></li> <li><a href="qtquick-particles-imageparticle-imageparticle-pro.html">particles/imageparticle/imageparticle.pro</a></li> <li><a href="qtquick-particles-imageparticle-imageparticle-qml.html">particles/imageparticle/imageparticle.qml</a></li> <li><a href="qtquick-particles-imageparticle-imageparticle-qmlproject.html">particles/imageparticle/imageparticle.qmlproject</a></li> <li><a href="qtquick-particles-imageparticle-imageparticle-qrc.html">particles/imageparticle/imageparticle.qrc</a></li> <li><a href="qtquick-particles-imageparticle-main-cpp.html">particles/imageparticle/main.cpp</a></li> </ul> </div> <!-- @@@particles/imageparticle --> </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>