Path Animation not Animating



  • 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.



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


Log in to reply
 

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