Results 1 to 5 of 5

Thread: QML animations based on states

  1. #1
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QML animations based on states

    Hi,

    I have created Sample.qml file and have

    Qt Code:
    1. import QtQuick 2.0
    2. import QtQuick.Window 2.0
    3.  
    4. Rectangle {
    5. id: root
    6. width: Screen.width
    7. height: Screen.height
    8.  
    9. Rectangle{
    10. id: r1
    11. width: 100
    12. height: 100
    13. x: 200
    14. y: 200
    15. color: "green"
    16. }
    17.  
    18. Rectangle{
    19. id: r2
    20. width: 100
    21. height: 100
    22. x: 400
    23. y: 200
    24. color: "cyan"
    25. visible: false
    26. }
    27. }
    To copy to clipboard, switch view to plain text mode 

    Here rectangle r1 is visible and r2 is non-visible. I want PropertyAnimation on r1 and change its opacity to 0.01. Then once this animation is ended I want r2 to become visible and separate animation to start on r2 once it is visible.
    Can somebody please add necessary code to this. I know this has to be achieved through states and transitions.


    Thanks

    Manish

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML animations based on states

    It does not have to be achieved by states and transitions, though of course it is possible to use states to do the job.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QML animations based on states

    I want to manage from single qml file so still do you think states are not required. Can you pl. suggest some way out.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML animations based on states

    States are not required. You can define a SequentialAnimation object and trigger the animation whenever you want. Of course you can do the same as a state transition.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QML animations based on states

    Thanks. Done using SequentialAnimation

Similar Threads

  1. QPushButton with two states and colours
    By hildebrand in forum Newbie
    Replies: 3
    Last Post: 5th June 2013, 09:22
  2. Animations
    By hema in forum Newbie
    Replies: 2
    Last Post: 11th July 2011, 13:05
  3. Animations
    By hema in forum The GraphicsView Framework
    Replies: 0
    Last Post: 8th July 2011, 07:54
  4. Problem with QAbstractSocket and states.
    By nomadscarecrow in forum Qt Programming
    Replies: 0
    Last Post: 17th March 2010, 16:55
  5. setIcon() - different QIcon states?
    By AaronMK in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2008, 04:10

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.