AnchorAnimation QML Type
Anime les modifications des valeurs d'ancrage. En savoir plus...
| 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 sert à animer le changement d'ancrage.
Dans l'extrait de code suivant, nous animons l'ajout d'une ancre à droite à un élément ` 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 un « Transition », elle anime tous les changements d’ancrage ( AnchorChanges ) qui se sont produits lors du changement d’état. Ce comportement peut être redéfini en spécifiant un élément cible à l’aide de la propriété « AnchorChanges.target ».
Remarque : AnchorAnimation ne peut être utilisée que dans une transition d'Transition et en association avec un AnchorChange. Elle ne peut pas être utilisée dans les comportements ni dans d'autres types d'animations.
Voir également «Animation et transitions dans les transitions de style » ( Qt Quick ) et « Transitions de style » ( 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'accélération utilisée pour l'animation
Pour définir une courbe d'accélération, vous devez au moins préciser son type. Pour certaines courbes, vous pouvez également définir l'amplitude, la période et/ou le dépassement. La courbe d'accélération par défaut est « Linéaire ».
AnchorAnimation { easing.type: Easing.InOutQuad }Consultez la documentation d’ PropertyAnimation::easing.type pour plus d’informations sur les différents types de courbes d’accélération.
targets : list<Item> [read-only]
Les éléments à réancrer.
Si aucune cible n'est spécifiée, tous les éléments « AnchorChanges » seront animés par l'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.