<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Advice for doing a slot-machine animation]]></title><description><![CDATA[<p dir="auto">Dear all,<br />
I have 20 images and I want to create an animation like a slot-machine when a user click on a button and at the end of animation only one of the 20 image will be at the center of screen (choosen randomly).</p>
<p dir="auto">How can I do that with Qt Quick ??</p>
<p dir="auto">(I don't need the exact code... just some hints or pseudo-code for understanding which Item to use for doing that)</p>
<p dir="auto">Thanks,<br />
Gianluca.</p>
]]></description><link>https://forum.qt.io/topic/35326/advice-for-doing-a-slot-machine-animation</link><generator>RSS for Node</generator><lastBuildDate>Mon, 24 Aug 2026 04:37:14 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/35326.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 11 Dec 2013 09:45:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Advice for doing a slot-machine animation on Thu, 19 Dec 2013 17:41:27 GMT]]></title><description><![CDATA[<p dir="auto">FYI, just today I found an example using PathView that kind of looks like a slot-machine. It's in the new online QML book (best QML reference I've found): <a href="http://qmlbook.org/ch06/index.html#the-pathview" target="_blank" rel="noopener noreferrer nofollow ugc">http://qmlbook.org/ch06/index.html#the-pathview</a>.</p>
<p dir="auto">You may consider adapting the code in the example for your needs.</p>
]]></description><link>https://forum.qt.io/post/207983</link><guid isPermaLink="true">https://forum.qt.io/post/207983</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 19 Dec 2013 17:41:27 GMT</pubDate></item><item><title><![CDATA[Reply to Advice for doing a slot-machine animation on Thu, 12 Dec 2013 17:02:13 GMT]]></title><description><![CDATA[<p dir="auto">Some possibilities (I haven't tried any, so I'm not sure if they work):</p>
<p dir="auto">(1) The Path element has a closed property for defining a path that loops back on itself. You could try setting this to true. See if setting a high currentIndex value (a value larger than the largest) causes it to loopback around.</p>
<p dir="auto">(2) Same as (1) above, except instead of setting the currentIndex property directly, try using the PathView's incrementCurrentIndex() function. I suppose it's possible that this function has additional boundary logic in place that takes into account the closed property value setting and loops the currentIndex around properly.</p>
<p dir="auto">(3) Worst case, you have to adjust the currentIndex in such a way that it forces the slot machine to rotate in one direction. It would be this sequence:<br />
currentIndex = 0<br />
currentIndex = count - 1<br />
currentIndex = 0<br />
currentIndex = count - 1<br />
...<br />
This sequence should make the PathView rotate in a single direction.</p>
<p dir="auto">These are the only solutions I can think of. Perhaps someone else has some other ideas as well.</p>
]]></description><link>https://forum.qt.io/post/207192</link><guid isPermaLink="true">https://forum.qt.io/post/207192</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 12 Dec 2013 17:02:13 GMT</pubDate></item><item><title><![CDATA[Reply to Advice for doing a slot-machine animation on Thu, 12 Dec 2013 10:45:58 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for pointing me to PathView.<br />
It's the right item to do what I need, but there is just a little adjustment that I don't know how to do: make the movement of the items on a PathView only in one direction.<br />
In fact, if you change the currentIndex, the PathView move forward or backward depending on the shortest path to do… but I want that the PathView will move the item only forward, and never go backward.</p>
<p dir="auto">Is it possible ??</p>
]]></description><link>https://forum.qt.io/post/207140</link><guid isPermaLink="true">https://forum.qt.io/post/207140</guid><dc:creator><![CDATA[Gianluca]]></dc:creator><pubDate>Thu, 12 Dec 2013 10:45:58 GMT</pubDate></item><item><title><![CDATA[Reply to Advice for doing a slot-machine animation on Wed, 11 Dec 2013 17:08:55 GMT]]></title><description><![CDATA[<p dir="auto">One option may be to use the PathView element (<a href="http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick2-pathview.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick2-pathview.html</a>). The PathView element would provide you with a way to lay out your images to have a bit of a curvature to them (like a real slot machine). To make the slot machine spin, you could try animating the PathView's currentIndex property (for instance, by defining a Behavior for it).</p>
]]></description><link>https://forum.qt.io/post/207053</link><guid isPermaLink="true">https://forum.qt.io/post/207053</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Wed, 11 Dec 2013 17:08:55 GMT</pubDate></item></channel></rss>