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. Custom animation classes?
Qt 6.11 is out! See what's new in the release blog

Custom animation classes?

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.3k Views 1 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.
  • J Offline
    J Offline
    jsprenkle
    wrote on last edited by
    #1

    I'm interested in doing some sophisticated physics based animations of QML elements.
    I know I can perform the motion calculations to predict the path of the objects then use a PathAnimation object.
    This is fine unless I have to change the simulation during the animation.

    Can anyone offer any hints on how to write a custom animation class?
    If I implemented that I could incrementally calculate motion instead of having to predict / interrupt / predict.

    Thanks

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jsprenkle
      wrote on last edited by
      #2

      After a bit more review it appears the PathAnimation will not work. It animates the position of the item but can't be applied to any arbitrary property. (You can't use a path animation to control rotation).

      So it really looks like I have to implement a custom animation class to get what I want.

      1 Reply Last reply
      0
      • X Offline
        X Offline
        Xander84
        wrote on last edited by
        #3

        Hi, you may be able to extend the classes QAbstractAnimation or QPropertyAnimation and use it in QML. I haven't tried that myself but it should work I guess, take a look at the code at "qtbase/src/corelib/animation":https://qt.gitorious.org/qt/qtbase/source/db14f5fd605904965402042d656c73fc65fb6615:src/corelib/animation

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jsprenkle
          wrote on last edited by
          #4

          Thank you Xander. Hopefully it's easier to understand/refactor than to just re-invent!

          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