Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. SmoothedAnimation not looping

SmoothedAnimation not looping

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
animationloop
2 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tinnin
    wrote on last edited by kshegunov
    #1
    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]

    J 1 Reply Last reply
    0
    • T Tinnin
      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]

      J Offline
      J Offline
      JosephMills
      wrote on last edited by
      #2

      @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,

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved