ScaleAnimator QML Type

Der Typ ScaleAnimator animiert den Skalierungsfaktor 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::scale wird aktualisiert, nachdem die Animation beendet ist.

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

Rectangle {
    id: scalingBox
    width: 50
    height: 50
    color: "lightsteelblue"
    ScaleAnimator {
        target: scalingBox;
        from: 0.5;
        to: 1;
        duration: 1000
        running: true
    }
}

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

Rectangle {
    width: 50
    height: 50
    color: "lightsteelblue"
    ScaleAnimator on scale {
        from: 0.5;
        to: 1;
        duration: 1000
    }
}

Siehe auch Item::transformOrigin und RotationAnimator.

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