AnchorAnimation QML Type

动画锚点值的变化 更多...

import 语句: import QtQuick 2.7
继承: Animation

特性

详细描述

AnchorAnimation is used to animate an anchor change.

In the following snippet we animate the addition of a right anchor to a Rectangle :

import QtQuick 2.0
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"
}
					

AnchorAnimation is used in a Transition , it will animate any AnchorChanges that have occurred during the state change. This can be overridden by setting a specific target item using the AnchorChanges.target 特性。

注意: AnchorAnimation can only be used in a Transition and in conjunction with an AnchorChange. It cannot be used in behaviors and other types of animations.

另请参阅 Qt Quick 中的动画和过渡 and AnchorChanges .

特性文档编制

duration : int

This property holds the duration of the animation, in milliseconds.

The default value is 250.

easing group

easing.type : enumeration

easing.amplitude : real

easing.overshoot : real

easing.period : real

指定用于动画的缓和曲线

To specify an easing curve you need to specify at least the type. For some curves you can also specify amplitude, period and/or overshoot. The default easing curve is Linear.

AnchorAnimation { easing.type: Easing.InOutQuad }
										

PropertyAnimation::easing.type documentation for information about the different types of easing curves.

目标 : list < Item >

The items to reanchor.

If no targets are specified all AnchorChanges will be animated by the AnchorAnimation .