Results 1 to 2 of 2

Thread: How to change transform origin in NumberAnimation?

  1. #1
    Join Date
    Sep 2015
    Posts
    32
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to change transform origin in NumberAnimation?

    Hi everyone,

    Thread topic pretty much sums it up : ).

    I want to have a different origin than the default one for my transformation.

    Here is my code:

    Qt Code:
    1. ParallelAnimation {
    2. id: testAnimationDuPath1
    3. running: false
    4. loops: 1
    5.  
    6. NumberAnimation { target: itemPrincipal; property: "rotation"; to: 360; duration: 1500 }
    7. NumberAnimation { target: shell; property: "rotation"; to: 360; duration: 1500 }
    8.  
    9. }
    To copy to clipboard, switch view to plain text mode 

    What arguments should I use and where should I put them?

    Of maybe I need to use another function like RotationAnimation?
    If so I have have the same question, I could not find a specific answer as to changing the rotation origin.

    Yours,
    --Jay


    Added after 1 40 minutes:


    I managed to change the origin of rotation by adding this into the concerned item:

    Qt Code:
    1. transform: Rotation {
    2. id: shellRotation
    3. }
    4.  
    5. SequentialAnimation {
    6. id: shellRotationAnimation
    7.  
    8. running: false
    9.  
    10. PropertyAction { target: shellRotation; property: "origin.x"; value: 408 }
    11. PropertyAction { target: shellRotation; property: "origin.y"; value: 220 }
    12. NumberAnimation { target: shellRotation; property: "angle"; to: 360; easing.type: Easing.OutQuad; duration: 500 }
    13. }
    To copy to clipboard, switch view to plain text mode 

    Never know. Might help people : )

    --Jay
    Last edited by JaySDC; 14th September 2015 at 10:25.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to change transform origin in NumberAnimation?

    You can set a Rotation transformation on the item's transform property and then animate its angle property.
    http://doc.qt.io/qt-5/qml-qtquick-rotation.html

    Edit: if the origin doesn't need to change, you can already specify it at the Rotation element

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    JaySDC (15th September 2015)

Similar Threads

  1. Qml NumberAnimation
    By IgorP in forum Qt Quick
    Replies: 2
    Last Post: 22nd January 2015, 19:45
  2. QwtsSlider Scale Origin
    By fruzzo in forum Qwt
    Replies: 3
    Last Post: 23rd November 2011, 11:23
  3. Replies: 4
    Last Post: 26th September 2011, 22:55
  4. QwtThermo: origin of the fill
    By Marco Trapanese in forum Qwt
    Replies: 0
    Last Post: 31st May 2010, 14:50
  5. Rotating a rectangle about its origin
    By babu198649 in forum Newbie
    Replies: 5
    Last Post: 25th October 2008, 12:24

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.