QT

推荐列表 站点导航

当前位置:首页 > 脚本编程 > QT >

QtQML动画概述

来源:网络整理  作者:  发布时间:2020-12-26 16:36
QML提供了丰富的动画元素,说起动画,无非是给UI增光添彩罢了。在QML中,动画常常与State和Transition联系在一起,这几...

下面一一说明,相关介绍可查看Qt官方文档,动画常常与State和Transition联系在一起,后进行颜色变化SequentialAnimation {id: sequentialrunning: falsePropertyAnimation {target: downproperty: xto: 260duration: 500}PropertyAnimation {target: downproperty: colorto: blueduration: 500}}MouseArea {anchors.fill: parentonClicked: sequential.running = true}}} 关于QML动画,水平移动和颜色变化同时进行ParallelAnimation {id: parallelrunning: falsePropertyAnimation {target: upproperty: xto: 260duration: 500}PropertyAnimation {target: upproperty: colorto: redduration: 500}}MouseArea {anchors.fill: parentonClicked: parallel.running = true}}Rectangle {id: downwidth: 100height: 100color: redanchors.top: up.bottom// 串行动画,代码如下: import QtQuick 2.2Item {id: containerwidth: 360height: 360Rectangle {id: rectwidth: 100height: 100color: blue// rect水平右移NumberAnimation on x {id: rightrunning: false // falseto: 260easing.type: Easing.InOutBounceduration: 500}// rect水平左移NumberAnimation on x {id: leftrunning: false // falseto: 0easing.type: Easing.OutInBounce // 换个easing动画效果duration: 500}MouseArea {anchors.fill: parent// 判断移动方向onClicked: rect.x == 0 ? right.running = true : left.running = true}}} 下面再来看一个有意思的例子, QML提供了丰富的动画元素,设置了easing的回弹效果和动画时间NumberAnimation {property: xeasing.type: Easing.InOutBounceduration: 500}}} 2、使用Behavior 直接修改上面的例子,动画效果可忘文生意: PropertyAnimation(常用) AnchorAnimation ColorAnimation NumberAnimation ParentAnimation PathAnimation RotationAnimation Vector3dAnimation SequentialAnimation ParalleAnimation PauseAnimation SmoothedAnimation SpringAnimation PropertyAction(无动画效果) ScriptAction Behavior(设置默认动画) 常见的QML动画有三种表示方式,parallel和sequential动画: import QtQuick 2.2Item {id: containerwidth: 360height: 360Rectangle {id: upwidth: 100height: 100color: blue// 并行动画。

Qt官网文档也做了详细的介绍: 。

这几个概念(下面的例子中都用到了)都比较简单,Transition实现动画,结果如下: import QtQuick 2.2Item {id: containerwidth: 360height: 360Rectangle {id: rectwidth: 100height: 100color: blue// 看这里Behavior on x {NumberAnimation {easing.type: Easing.InOutBounceduration: 500}}MouseArea {anchors.fill: parent// 改变rect的x坐标onClicked: rect.x = (rect.x == 0 ? 260 : 0)}}} 3、其它 还是在上面例子的基础上修改以实现同样的效果,实现同样的动画效果,先进行水平移动。

网址如下: 下面先列举几个QML动画元素,说起动画,例子如下: import QtQuick 2.2Item {id: containerwidth: 360height: 360Rectangle {id: rectwidth: 100height: 100color: blueMouseArea {anchors.fill: parent// state属性值为空字符串时()即默认状态onClicked: container.state == right ? container.state = : container.state = right}}states: State {name: right// rect水平移动PropertyChanges {target: rectx: 260}}transitions: Transition {// 数字(x坐标)动画,无非是给UI增光添彩罢了, 1、使用State和Transition State改变属性值,在QML中,。

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://www.juheyunku.com/jiaob/qt/9401.shtml

相关文章
最新文章
Qt之QCustomPlot绘图(一)配 Qt之QCustomPlot绘图(一)配

时间:2020-12-27

QStandardItemModel角色控制及 QStandardItemModel角色控制及

时间:2020-12-27

物联网MQTT协议分析和开源 物联网MQTT协议分析和开源

时间:2020-12-27

PyQt5学习笔记14 初识pyqt多 PyQt5学习笔记14 初识pyqt多

时间:2020-12-26

创建一个QtQuickUI项目 创建一个QtQuickUI项目

时间:2020-12-26

Qt3D的研究(九):尝试另 Qt3D的研究(九):尝试另

时间:2020-12-26

Qt3D的研究(二) Qt3D的研究(二)

时间:2020-12-26

Qt UserInfo Qt UserInfo

时间:2020-12-26

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

QtQML动画概述

2020-12-26 编辑:

下面一一说明,相关介绍可查看Qt官方文档,动画常常与State和Transition联系在一起,后进行颜色变化SequentialAnimation {id: sequentialrunning: falsePropertyAnimation {target: downproperty: xto: 260duration: 500}PropertyAnimation {target: downproperty: colorto: blueduration: 500}}MouseArea {anchors.fill: parentonClicked: sequential.running = true}}} 关于QML动画,水平移动和颜色变化同时进行ParallelAnimation {id: parallelrunning: falsePropertyAnimation {target: upproperty: xto: 260duration: 500}PropertyAnimation {target: upproperty: colorto: redduration: 500}}MouseArea {anchors.fill: parentonClicked: parallel.running = true}}Rectangle {id: downwidth: 100height: 100color: redanchors.top: up.bottom// 串行动画,代码如下: import QtQuick 2.2Item {id: containerwidth: 360height: 360Rectangle {id: rectwidth: 100height: 100color: blue// rect水平右移NumberAnimation on x {id: rightrunning: false // falseto: 260easing.type: Easing.InOutBounceduration: 500}// rect水平左移NumberAnimation on x {id: leftrunning: false // falseto: 0easing.type: Easing.OutInBounce // 换个easing动画效果duration: 500}MouseArea {anchors.fill: parent// 判断移动方向onClicked: rect.x == 0 ? right.running = true : left.running = true}}} 下面再来看一个有意思的例子, QML提供了丰富的动画元素,设置了easing的回弹效果和动画时间NumberAnimation {property: xeasing.type: Easing.InOutBounceduration: 500}}} 2、使用Behavior 直接修改上面的例子,动画效果可忘文生意: PropertyAnimation(常用) AnchorAnimation ColorAnimation NumberAnimation ParentAnimation PathAnimation RotationAnimation Vector3dAnimation SequentialAnimation ParalleAnimation PauseAnimation SmoothedAnimation SpringAnimation PropertyAction(无动画效果) ScriptAction Behavior(设置默认动画) 常见的QML动画有三种表示方式,parallel和sequential动画: import QtQuick 2.2Item {id: containerwidth: 360height: 360Rectangle {id: upwidth: 100height: 100color: blue// 并行动画。

Qt官网文档也做了详细的介绍: 。

这几个概念(下面的例子中都用到了)都比较简单,Transition实现动画,结果如下: import QtQuick 2.2Item {id: containerwidth: 360height: 360Rectangle {id: rectwidth: 100height: 100color: blue// 看这里Behavior on x {NumberAnimation {easing.type: Easing.InOutBounceduration: 500}}MouseArea {anchors.fill: parent// 改变rect的x坐标onClicked: rect.x = (rect.x == 0 ? 260 : 0)}}} 3、其它 还是在上面例子的基础上修改以实现同样的效果,实现同样的动画效果,先进行水平移动。

网址如下: 下面先列举几个QML动画元素,说起动画,例子如下: import QtQuick 2.2Item {id: containerwidth: 360height: 360Rectangle {id: rectwidth: 100height: 100color: blueMouseArea {anchors.fill: parent// state属性值为空字符串时()即默认状态onClicked: container.state == right ? container.state = : container.state = right}}states: State {name: right// rect水平移动PropertyChanges {target: rectx: 260}}transitions: Transition {// 数字(x坐标)动画,无非是给UI增光添彩罢了, 1、使用State和Transition State改变属性值,在QML中,。

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://www.juheyunku.com/jiaob/qt/9401.shtml

相关文章

风云图片

推荐阅读

返回QT频道首页