QML类型说明-AnchorAnimation

来源:互联网 发布:鄂州软件开发公司 编辑:程序博客网 时间:2024/04/29 22:41

AnchorAnimation

ImportStatement:   import QtQuick2.2

Inherits:     Animation

 

Properties

duration : int

easing

easing.type : enumeration

easing.amplitude : real

easing.overshoot : real

easing.period : real

targets : list

 

DetailedDescription

AnchorAnimation用于描述动画的锚的变化。

下面的代码片断,我们右锚接一个矩形到动画。

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 newposition

AnchorAnimation { duration: 1000 }

}

Component.onCompleted: container.state ="reanchored"

}

当AnchorAnimation被用在过渡中,它将在状态变化时发生锚改变动画。它用AnchorChanges.target属性重置指定的目标。

注意AnchorAnimation仅仅只能用于Transition并和一个AnchorChange结合。它不能用于behaviors和其他类型的动画。同时参阅Animation、Transitions以及AnchorChanges。

 

PropertyDocumentation

duration : int

动画持续的时间,以毫秒为单位。默认值是250。

 

easing group

easing.type : enumeration

easing.amplitude : real

easing.overshoot : real

easing.period : real

指定动画曲线。至少需要指定类型。对一些曲线,我们还可以指定振幅、时间和过冲。默认的动画曲线是线性的。

示例代码:

AnchorAnimation { easing.type: Easing.InOutQuad}

同时参阅PropertyAnimation::easing.type文档了解动画曲线的不同类型。

 

targets : list

重新锚定的目标。如果没有指定,那所有的AnchorChanges将被AnchorAnimation动画化。
0 0
原创粉丝点击