Results 1 to 3 of 3

Thread: Rotation Animation doesn't proceed after following animation restart

  1. #1
    Join Date
    Feb 2012
    Posts
    4
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Rotation Animation doesn't proceed after following animation restart

    Hi All,
    I am a new in QML area but with years of experience in C++ but lately I hit an issue with Rotation Animation after I restarted animation
    of rotating and bouncing ball.
    After app is started the ball correctly moves, rotates and bounces. But after I click the ball to restart the animation the ball moves, bounces like before but does not rotate. Is it anything missed in the code below. The code is taken from online book Qt5 cadaques. Is anything missed or is it not found yet bug in Qt QML?

    import QtQuick 2.2
    import QtQuick.Window 2.1

    Window {
    visible: true
    width: root.width
    height: root.height

    Image {
    id: root
    width: 480
    height: 350

    property int duration: 3000

    Rectangle {
    id: sky
    width: parent.width
    height: 200
    gradient: Gradient {
    GradientStop { position: 0.0; color: "#0080FF"}
    GradientStop { position: 1.0; color: "#66CCFF"}
    }
    }

    Rectangle {
    id: ground
    anchors.top: sky.bottom
    anchors.bottom: root.bottom
    width: parent.width
    gradient: Gradient {
    GradientStop { position: 0.0; color: "#00FF00"}
    GradientStop { position: 1.0; color: "#00803F"}
    }
    }
    }

    Image {
    id: ball
    x: 20; y: 240
    rotation: 0
    source: "assets/Soccer_ball.png"

    MouseArea {
    anchors.fill: parent
    onClicked: {
    ball.x = 20; ball.y = 240
    anim.restart()
    }
    }
    }

    ParallelAnimation {
    id: anim

    SequentialAnimation {

    NumberAnimation {
    target : ball
    properties: "y"
    to: 20
    duration: root.duration * 0.4
    easing.type: Easing.OutCirc
    }

    NumberAnimation {
    target: ball
    properties: "y"
    to: 240
    duration: root.duration * 0.6
    easing.type: Easing.OutBounce
    }
    }

    NumberAnimation {
    target: ball
    properties: "x"
    to: 400
    duration: root.duration
    }

    RotationAnimation {
    target: ball
    properties: "rotation"
    to: 720
    duration: root.duration * 1.1
    }
    }
    }
    Attached Images Attached Images
    Last edited by sniegu84; 5th January 2015 at 16:26.

  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: Rotation Animation doesn't proceed after following animation restart

    I'd say because the rotation value is not reset on mouse click.

    Cheers,
    _

  3. #3
    Join Date
    Feb 2012
    Posts
    4
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Rotation Animation doesn't proceed after following animation restart

    Yes exactly. I found the solution before entered the thread again. Sometimes a man is blind.
    Last edited by sniegu84; 8th January 2015 at 21:07.

Similar Threads

  1. Animation in Qt
    By trasher in forum Qt Programming
    Replies: 0
    Last Post: 19th May 2014, 22:46
  2. Replies: 2
    Last Post: 27th July 2012, 21:52
  3. Replies: 1
    Last Post: 27th July 2012, 17:33
  4. qml animation
    By vinayaka in forum Qt Quick
    Replies: 2
    Last Post: 21st September 2011, 06:44
  5. The QT creater doesn't on every restart on linux 64 bit machine.
    By parag3gwl in forum Installation and Deployment
    Replies: 0
    Last Post: 5th January 2011, 09:14

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.