SmoothedAnimation not looping



  • SmoothedAnimation {
            id: groundAnimation
            running: true
            target: groundImage
            property: "x"
            from: 0
            to: -(groundImage.spriteWidth)
            velocity: ground.parent.relativeVelocity
            loops: Animation.Infinite
        }
    

    I changed this from NumberAnimation to SmoothedAnimation in the hope that I could alter the speed of the animation with SmoothedAnimation's velocity property as I couldn't affect the duration of NumberAnimation without restarting the animation after updating the duration.

    However, before I can even test if I can update the velocity without restarting the animation I have hit another snag. The SmoothedAnimation isn't looping. It runs once and stops.

    Can it loop? If so, how?

    [Moved to Qt Quick ~kshegunov]



  • @Tinnin said in SmoothedAnimation not looping:

    SmoothedAnimation

    You have from and to but nothing to make x Go back to zero Make a SequentialAnimation and have your steps in there. .

      from: 0
      to: -(groundImage.spriteWidth)
    

    then

    from: -(groundImage.spriteWidth) 
    to: 0
    

    put your loop on your SequentialAnimation and not on your SmoothedAnimation same with running and the id that I am guessing this is how you trigger,


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.