Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How best to create a repeating animation?
Forum Updated to NodeBB v4.3 + New Features

How best to create a repeating animation?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 241 Views 2 Watching
  • 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.
  • idlefrogI Offline
    idlefrogI Offline
    idlefrog
    wrote on last edited by idlefrog
    #1

    Lets say I want to animate a graphics item that draws a circle. I want to animate it's radius.
    However, I want to cycle from a radius of 0 to 10 three times. How best to do it?

    I assume I would use something like QPropertyAnimation on a class like the one below:

    class Circle: public QGraphicsItem
    {
      Q_PROPERTY(int radius READ radius WRITE setRadius)
    ...
    }
    

    Of course going from radius 0 to R, is easy, but what would be a natural animation-framework way of going from 0->R three of more times?
    Should I just create another timer that resets the radius, and just restarts the animation? Or is there a more natural way?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Isn't the QAbstractAnimation::loopCount property what you are looking for ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      idlefrogI 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Isn't the QAbstractAnimation::loopCount property what you are looking for ?

        idlefrogI Offline
        idlefrogI Offline
        idlefrog
        wrote on last edited by
        #3

        @SGaist Oh!... yes! I thought there had to be a better way. Thank you very much!. Most helpful!!!! Thankyou!

        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