Results 1 to 2 of 2

Thread: How can I stop an infinite animation ? (with non-infinitive animation)

  1. #1
    Join Date
    Jul 2012
    Posts
    26
    Thanks
    3
    Platforms
    Windows

    Default How can I stop an infinite animation ? (with non-infinitive animation)

    Hi,

    I have a infinite animation and 1 loop animation in same QML file.

    I want that when 1 loop animation complete itself, infinite animation also complete itself. But not stop, totally complete the animation. (maybe with complete() )

    How can I do that?

    Note: I want that, when 1 loop animation completes itself, all animations complete themselves. In this way, I can use all animations again and again with call them with different if situations.

    Note 2 : Actually I want to know how can I determine if or not a animation complete itself ? Is there any special code for it?

  2. #2
    Join Date
    Jul 2012
    Posts
    26
    Thanks
    3
    Platforms
    Windows

    Default Re: How can I stop an infinite animation ? (with non-infinitive animation)

    ok I solved it maybe other people also need it:

    Qt Code:
    1. Item {
    2. id: the_item
    3. height: 480
    4. width: 854
    5.  
    6. Rectangle {
    7. id:rect
    8. height: 120
    9. width: 300
    10. color: "blue"
    11. anchors.verticalCenter: the_item.verticalCenter
    12. anchors.horizontalCenter: the_item.horizontalCenter
    13.  
    14. NumberAnimation on rotation { id: rot; from: 0; to:230; duration: 2000; loops: Animation.Infinite }
    15.  
    16. NumberAnimation on opacity { id: opa; from: 1; to: 0.5; duration: 2000; loops: 1 }
    17.  
    18. onOpacityChanged: {
    19. if(rect.opacity == 0.5){
    20. opa.stop();
    21. rot.stop();
    22. }
    23. }
    24.  
    25. }
    26.  
    27. Rectangle {
    28. id: button
    29. height: 50
    30. width: 50
    31. color: "red"
    32. anchors.right: parent.right
    33. anchors.top: parent.top
    34. anchors.rightMargin: 15
    35. anchors.topMargin: 15
    36.  
    37. MouseArea {
    38. anchors.fill: parent
    39. onPressed: {
    40. if(rect.opacity == 0.5){
    41. opa.start();
    42. rot.start();
    43. }
    44. }
    45. }
    46.  
    47. }
    48.  
    49. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. animation in qt
    By rimie23 in forum Qt Programming
    Replies: 4
    Last Post: 6th May 2012, 11:09
  2. QThread : how to stop an infinite loop
    By TarielVincent in forum Qt Programming
    Replies: 9
    Last Post: 24th February 2012, 21:22
  3. qml animation
    By vinayaka in forum Qt Quick
    Replies: 2
    Last Post: 21st September 2011, 05:44
  4. QML Animation
    By ujwala in forum Qt Quick
    Replies: 3
    Last Post: 11th August 2011, 08:14
  5. Animation in Qt
    By yogesh884 in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2009, 09:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.