[Interest] Updating NumberAnimation from/to at runtime

Jérôme Godbout jerome at bodycad.com
Fri Jul 14 14:53:47 CEST 2017


The other point I can see, just make sure you set the animation *alwaysRunToEnd
*according to your needs (I suspect false here).
http://doc.qt.io/qt-5/qml-qtquick-animation.html#alwaysRunToEnd-prop



[image: bodycad] <https://www.bodycad.com/>
Jerome Godbout
Software Developer
2035 rue du Haut-Bord, Québec, QC, Canada. G1N 4R7
T:  +1 418 527-1388
E: jerome at bodycad.com
www.bodycad.com

The contents of this email message and any attachments are intended solely
for the addressee(s) and may contain confidential and/or privileged
information and may be legally protected from disclosure. If you are not
the intended recipient of this message or their agent, or if this message
has been addressed to you in error, please immediately alert the sender by
reply email and then delete this message and any attachments. If you are
not the intended recipient, you are hereby notified that any use,
dissemination, copying, or storage of this message or its attachments is
strictly prohibited.

Le contenu de ce message et les pièces jointes sont destinés uniquement
pour le(s) destinataire(s) et peuvent contenir des informations
confidentielles et / ou privilégiées qui peuvent être protégées légalement
contre toute divulgation. Si vous n'êtes pas le destinataire de ce message
ou son agent, ou si ce message vous a été adressé par erreur, s’il vous
plaît avertir immédiatement l'expéditeur par courriel de réponse, puis
supprimer ce message et les pièces jointes. Si vous n'êtes pas le
destinataire prévu, vous êtes par la présente informé que toute
utilisation, diffusion, copie, ou stockage de ce message ou de ses pièces
jointes est strictement interdit.

On Fri, Jul 14, 2017 at 8:46 AM, Jérôme Godbout <jerome at bodycad.com> wrote:

> You can activate the clip into the red r1 rectangle and see if this is
> what you are looking for
>
> clip: true
>
> This will prevent the blue r2 rectangle to be displayed outside the r1.
>
> Rectangle {
>         id: r1
>         anchors.centerIn: parent
>         width: 300; height: 100
>         color: "red"
> clip: true
> ...
>
> [image: bodycad] <https://www.bodycad.com/>
> Jerome Godbout
> Software Developer
> 2035 rue du Haut-Bord, Québec, QC, Canada. G1N 4R7
> T:  +1 418 527-1388 <(418)%20527-1388>
> E: jerome at bodycad.com
> www.bodycad.com
>
> The contents of this email message and any attachments are intended solely
> for the addressee(s) and may contain confidential and/or privileged
> information and may be legally protected from disclosure. If you are not
> the intended recipient of this message or their agent, or if this message
> has been addressed to you in error, please immediately alert the sender by
> reply email and then delete this message and any attachments. If you are
> not the intended recipient, you are hereby notified that any use,
> dissemination, copying, or storage of this message or its attachments is
> strictly prohibited.
>
> Le contenu de ce message et les pièces jointes sont destinés uniquement
> pour le(s) destinataire(s) et peuvent contenir des informations
> confidentielles et / ou privilégiées qui peuvent être protégées légalement
> contre toute divulgation. Si vous n'êtes pas le destinataire de ce message
> ou son agent, ou si ce message vous a été adressé par erreur, s’il vous
> plaît avertir immédiatement l'expéditeur par courriel de réponse, puis
> supprimer ce message et les pièces jointes. Si vous n'êtes pas le
> destinataire prévu, vous êtes par la présente informé que toute
> utilisation, diffusion, copie, ou stockage de ce message ou de ses pièces
> jointes est strictement interdit.
>
> On Fri, Jul 14, 2017 at 5:27 AM, Shantanu Tushar <shaan7in at gmail.com>
> wrote:
>
>> Hi,
>>
>> Consider the following code which draws two rectangles - a red rectangle
>> which contains another blue rectangle.
>>
>> Rectangle {
>>         id: r1
>>         anchors.centerIn: parent
>>         width: 300; height: 100
>>         color: "red"
>>
>>         Rectangle {
>>             id: r2
>>             width: 100; height: 100
>>             color: "blue"
>>
>>             NumberAnimation on x {
>>                 loops: Animation.Infinite
>>                 from: 0; to: r1.width-r2.width
>>                 duration: 1000
>>
>>                 onToChanged: console.log(to)
>>             }
>>         }
>>
>>         NumberAnimation on width {
>>             loops: Animation.Infinite
>>             from: 300; to: 100
>>             duration: 10000
>>         }
>>     }
>>
>> The blue rectangle is supposed to keep moving inside the red rectangle by
>> means of a NumberAnimation. However, the width of the red rectangle changes
>> according to another animation.
>>
>> I thought this will work fine and the blue rectangle will be confined to
>> the red rectangle because of the following binding-
>>
>> to: r1.width-r2.width
>>
>> However, thats not what happens. The blue rectangle overflows the red
>> rectangle, as if the binding never got updated. But, I can see that the
>> `console.log(to)` does prove the binding is working.
>>
>> (Screenshot at http://i.imgur.com/yDTYbv9.png )
>>
>> Is this a limitation of NumberAnimation? Or am I using it wrong?
>>
>> --
>> Shantanu Tushar    (UTC +0530)
>> shantanu.io
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170714/b1c3d5da/attachment.html>


More information about the Interest mailing list