PropertyAnimation

来源:互联网 发布:社交网络营销策划方案 编辑:程序博客网 时间:2024/06/06 12:22

PropertyAnimation

在过渡中使用

  Rectangle {      id: rect      width: 100; height: 100      color: "red"      states: State {          name: "moved"          PropertyChanges { target: rect; x: 50 }      }      transitions: Transition {          PropertyAnimation { properties: "x,y"; easing.type: Easing.InOutQuad }      }  }

在Behavior

 Rectangle {      width: 100; height: 100      color: "red"      Behavior on x { PropertyAnimation {} }      MouseArea { anchors.fill: parent; onClicked: parent.x = 50 }  }

在组合动画中

  Rectangle {      width: 100; height: 100      color: "red"      SequentialAnimation on x {          loops: Animation.Infinite          PropertyAnimation { to: 50 }          PropertyAnimation { to: 0 }      }  }

在信号处理中

  MouseArea {      anchors.fill: theObject      onClicked: PropertyAnimation { target: theObject; property: "opacity"; to: 0 }  }

单独使用

  Rectangle {      id: theRect      width: 100; height: 100      color: "red"      // this is a standalone animation, it's not running by default      PropertyAnimation { id: animation;                          target: theRect;                          property: "width";                          to: 30;                          duration: 500 }      MouseArea { anchors.fill: parent; onClicked: animation.running = true }  }
0 0
原创粉丝点击