Nesta página

AnchorAnimation QML Type

Anima as alterações nos valores das âncoras. Mais...

Import Statement: import QtQuick
Inherits:

Animation

Propriedades

Descrição detalhada

AnchorAnimation é usado para animar uma mudança de âncora.

No trecho de código a seguir, animamos a adição de uma âncora à direita em um ` 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"
}

Quando um AnchorAnimation é usado em um Transition, ele animará qualquer AnchorChanges que tenha ocorrido durante a mudança de estado. Isso pode ser substituído definindo-se um item-alvo específico por meio da propriedade AnchorChanges.target.

Observação: o AnchorAnimation só pode ser usado em um Transition e em conjunto com um AnchorChange. Ele não pode ser usado em comportamentos e outros tipos de animações.

Veja também Animações e transições em Qt Quick e AnchorChanges.

Documentação da propriedade

duration : int

Essa propriedade define a duração da animação, em milissegundos.

O valor padrão é 250.

easing group

easing.amplitude : real

easing.overshoot : real

easing.period : real

easing.type : enumeration

Especifica a curva de aceleração usada na animação

Para especificar uma curva de aceleração, é necessário definir, no mínimo, o tipo. Para algumas curvas, também é possível especificar amplitude, período e/ou overshoot. A curva de aceleração padrão é Linear.

AnchorAnimation { easing.type: Easing.InOutQuad }

Consulte a documentação do PropertyAnimation::easing.type para obter informações sobre os diferentes tipos de curvas de aceleração.

targets : list<Item> [read-only]

Os itens a serem reancorados.

Se nenhum alvo for especificado, todos os AnchorChanges serão animados pelo 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.