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. Path Animation not Animating

Path Animation not Animating

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 726 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.
  • J Offline
    J Offline
    Jpraccio
    wrote on last edited by
    #1

    Hi,

    I am trying to animate a QML object along a path. The Object is created dynamically in JS. And the animation is started after the object has been create. For some reason, it is not displaying any movement. However, I can verify that the animation is running.

    Here are the important bits of code:
    The object, only included the root of it and animation. Its children are images and text.

    Petal {
        id: petalRoot;
        objectName: "petal"
        property alias src: petalImage.source
    
        property alias targetX: thePathLine.x
        property alias targetY: thePathLine.y
        property alias originX: parentPath.startX
        property alias originY: parentPath.startY
    
        property bool inSequencer: false
    
        PathAnimation {
            id: petalAnimation
    
            duration: 250
    
            path: Path {
                id: parentPath
    
                PathLine {
                    id: thePathLine
                }
            }
        }
    ...
    }
    

    Here is where the objects are created:

    var petal = comp.createObject(blossomViewRect, {
                                                 "src": mainWindow.petal_src + model.colorProgression + ".png",
                                                 "chord": chords[i],
                                                 "x": centerPetalX,
                                                 "y": centerPetalY,
                                                 "originX": centerPetalX,
                                                 "originY": centerPetalY,
                                                 "targetX": centerPetalX + points[i].x,
                                                 "targetY": centerPetalY + points[i].y,
                                             });
    
               petal.onPetalDoubleClicked.connect(blossomScreenRoot.addChord);
               petal.generateChordName();
               petals.push(petal);
    
               petal.startAnimation();
    

    Let me know if you need more.

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

      Solved it. Just had to set the "target" of the animation to the root object.

      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