En esta página

AnchorAnimation QML Type

Anima los cambios en los valores de los puntos de anclaje. Más...

Import Statement: import QtQuick
Inherits:

Animation

Propiedades

Descripción detallada

AnchorAnimation se utiliza para animar un cambio de ancla.

En el siguiente fragmento de código animamos la adición de un ancla a la derecha en un ` 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"
}

Cuando se utiliza AnchorAnimation en un « Transition », animará cualquier « AnchorChanges » que haya tenido lugar durante el cambio de estado. Esto se puede anular estableciendo un elemento de destino específico mediante la propiedad « AnchorChanges.target ».

Nota: AnchorAnimation solo se puede utilizar en un « Transition » y junto con un «AnchorChange». No se puede utilizar en comportamientos ni en otros tipos de animaciones.

Véase también «Animación y transiciones» en Qt Quick y AnchorChanges.

Documentación de la propiedad

duration : int

Esta propiedad indica la duración de la animación, en milisegundos.

El valor por defecto es 250.

easing group

easing.amplitude : real

easing.overshoot : real

easing.period : real

easing.type : enumeration

Especifica la curva de aceleración utilizada para la animación

Para especificar una curva de aceleración, es necesario indicar al menos el tipo. En el caso de algunas curvas, también se puede especificar la amplitud, el período y/o el sobreimpulso. La curva de aceleración predeterminada es «Lineal».

AnchorAnimation { easing.type: Easing.InOutQuad }

Consulta la documentación de PropertyAnimation::easing.type para obtener información sobre los diferentes tipos de curvas de aceleración.

targets : list<Item> [read-only]

Los elementos que se van a reanclar.

Si no se especifican objetivos, todos los elementos « AnchorChanges » se animarán mediante el « 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.