En esta página

ScaleAnimator QML Type

El tipo ScaleAnimator anima el factor de escala de un Item. Más...

Import Statement: import QtQuick
Inherits:

Animator

Descripción detallada

Animator son diferentes de los tipos de Animación normales. Cuando se utiliza un Animator, la animación puede ser ejecutada en el hilo de renderizado y el valor de la propiedad saltará al final cuando la animación esté completa.

El valor de Item::scale se actualiza después de que la animación ha terminado.

El siguiente fragmento muestra cómo utilizar un ScaleAnimator junto con un elemento Rectangle.

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

También es posible utilizar la palabra clave on para vincular el ScaleAnimator directamente a una instancia de Item.

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

Nota: Los tipos de animador no tienen ningún beneficio cuando se utiliza un bucle de renderizado no subprocesado.

Nota: Se recomienda que las aplicaciones consideren diseños basados en principios multihilo y asíncronos, en lugar de confiar en Animators para mostrar contenido animado mientras se realiza un trabajo costoso y bloqueante en el hilo principal (GUI). En lugar de operaciones largas y bloqueantes, prefiera utilizar WorkerScript y asynchronous image loading en QML, e hilos de trabajo, algoritmos paralelos, Qt Concurrenty coroutines en C++, manteniendo así la respuesta de toda la aplicación y la interfaz de usuario en todo momento.

Véase también Item::transformOrigin y RotationAnimator.

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