YAnimator QML Type

The YAnimator type animates the y position of an Item. 更多...

import 语句: import QtQuick 2.12
Since: Qt 5.2
继承: Animator

详细描述

Animator types are different from normal Animation types. When using an Animator, the animation can be run in the render thread and the property value will jump to the end when the animation is complete.

Item::y is updated after the animation has finished.

The following snippet shows how to use a YAnimator together with a Rectangle item.

Rectangle {
    id: ymovingBox
    width: 50
    height: 50
    color: "lightsteelblue"
    YAnimator {
        target: ymovingBox;
        from: 10;
        to: 0;
        duration: 1000
        running: true
    }
}
					

It is also possible to use the on keyword to tie the YAnimator directly to an Item instance.

Rectangle {
    width: 50
    height: 50
    color: "lightsteelblue"
    YAnimator on y {
        from: 10;
        to: 0;
        duration: 1000
    }
}