AnchorAnimation QML Type
Anime les changements de valeurs d'ancrage. Plus d'informations...
| Import Statement: | import QtQuick |
| Inherits: |
Propriétés
- duration : int
- easing
- easing.amplitude : real
- easing.overshoot : real
- easing.period : real
- easing.type : enumeration
- targets : list<Item>
Description détaillée
AnchorAnimation est utilisé pour animer un changement d'ancre.
Dans l'extrait suivant, nous animons l'ajout d'une ancre droite à une page Rectangle:
import QtQuick Item { id: container width: 200; height: 200 Rectangle { id: myRect width: 100; height: 100 color: "red" } states: State { name: "reanchored" AnchorChanges { target: myRect; anchors.right: container.right } } transitions: Transition { // smoothly reanchor myRect and move into new position AnchorAnimation { duration: 1000 } } Component.onCompleted: container.state = "reanchored" }
Lorsqu'une AnchorAnimation est utilisée dans une Transition, elle anime toutes les AnchorChanges qui se sont produites pendant le changement d'état. Il est possible de déroger à cette règle en définissant un élément cible spécifique à l'aide de la propriété AnchorChanges.target.
Remarque : AnchorAnimation ne peut être utilisé que dans une page Transition et en conjonction avec un AnchorChange. Elle ne peut pas être utilisée dans des comportements ou d'autres types d'animations.
Voir également Animation et Transitions dans Qt Quick et AnchorChanges.
Documentation sur les propriétés
duration : int
Cette propriété indique la durée de l'animation, en millisecondes.
La valeur par défaut est 250.
easing group
Spécifie la courbe d'assouplissement utilisée pour l'animation
Pour spécifier une courbe d'assouplissement, vous devez au moins spécifier le type. Pour certaines courbes, vous pouvez également spécifier l'amplitude, la période et/ou le dépassement. La courbe d'assouplissement par défaut est linéaire.
AnchorAnimation { easing.type: Easing.InOutQuad }
Consultez la documentation de PropertyAnimation::easing.type pour obtenir des informations sur les différents types de courbes d'assouplissement.
targets : list<Item> [read-only]
Les éléments à ancrer.
Si aucune cible n'est spécifiée, toutes les AnchorChanges seront animées par la AnchorAnimation.
© 2026 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.