XAnimator QML Type

Der Typ XAnimator animiert die x-Position eines Objekts. Mehr...

Import Statement: import QtQuick
Inherits:

Animator

Detaillierte Beschreibung

Animator Typen unterscheiden sich von normalen Animationstypen. Wenn ein Animator verwendet wird, kann die Animation im Render-Thread ausgeführt werden und der Eigenschaftswert springt zum Ende, wenn die Animation abgeschlossen ist.

Der Wert von Item::x wird aktualisiert, nachdem die Animation beendet ist.

Der folgende Ausschnitt zeigt, wie man einen XAnimator zusammen mit einem Rectangle-Element verwendet.

Rectangle {
    id: xmovingBox
    width: 50
    height: 50
    color: "lightsteelblue"
    XAnimator {
        target: xmovingBox;
        from: 10;
        to: 0;
        duration: 1000
        running: true
    }
}

Es ist auch möglich, das Schlüsselwort on zu verwenden, um den XAnimator direkt mit einer Item-Instanz zu verbinden.

Rectangle {
    width: 50
    height: 50
    color: "lightsteelblue"
    XAnimator on x {
        from: 10;
        to: 0;
        duration: 1000
    }
}

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.