Qt/QML学习-动画元素

QML学习

main.qml

import QtQuick 2.15
import QtQuick.Window 2.15

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    Rectangle {
        id: rect
        width: 50
        height: 50
        color: "red"
    }

    SequentialAnimation {
        running: true
        ParallelAnimation {
            ColorAnimation {
                target: rect
                property: "color"
                from: "red"
                to: "blue"
                duration: 500
            }

            NumberAnimation {
                target: rect
                property: "x"
                from: 0
                to: 200
                duration: 500
            }
        }

        PropertyAction {
            target: rect
            property: "x"
            value: 0
        }

        PauseAnimation {
            duration: 500
        }

        ScriptAction {
            script: myScript()
        }

        PropertyAnimation {
            target: rect
            property: "width"
            from: 50
            to: 200
            duration: 500
        }
    }

    Text {
        id: text
        anchors.top: rect.bottom
        font.pointSize: 30
        text: "点赞+关注"
    }

    function myScript() {
        text.text = "执行ScriptAction"
    }
}

演示

相关推荐

  1. Qt/QML学习-动画元素

    2024-07-13 23:42:03       22 阅读
  2. Android共享元素动画

    2024-07-13 23:42:03       51 阅读
  3. dom元素+CSS实现阶梯动画效果

    2024-07-13 23:42:03       39 阅读
  4. jquery删除一个页面元素动画特效

    2024-07-13 23:42:03       35 阅读
  5. GSAP动画学习

    2024-07-13 23:42:03       36 阅读
  6. CSS动画 学习

    2024-07-13 23:42:03       25 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-13 23:42:03       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-13 23:42:03       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-13 23:42:03       58 阅读
  4. Python语言-面向对象

    2024-07-13 23:42:03       69 阅读

热门阅读

  1. 小程序自学教程

    2024-07-13 23:42:03       19 阅读
  2. C#的DllImport使用方法

    2024-07-13 23:42:03       18 阅读
  3. Elasticsearch-多边形范围查询(8.x)

    2024-07-13 23:42:03       20 阅读
  4. SpringBoot后端代码基本逻辑

    2024-07-13 23:42:03       18 阅读
  5. 响应式编程-数据劫持

    2024-07-13 23:42:03       20 阅读
  6. Vue-生命周期勾子函数

    2024-07-13 23:42:03       17 阅读
  7. 计算机如何学习

    2024-07-13 23:42:03       17 阅读
  8. 要修改已经推送到远程仓库的提交信息

    2024-07-13 23:42:03       18 阅读
  9. linux 设置nginx开机自启

    2024-07-13 23:42:03       22 阅读
  10. c++贪心算法

    2024-07-13 23:42:03       19 阅读
  11. ArcGIS Pro SDK (八)地理数据库 4 查询

    2024-07-13 23:42:03       16 阅读
  12. 文本语言的上升沿写法

    2024-07-13 23:42:03       17 阅读
  13. Aop实现后端数据重复提交

    2024-07-13 23:42:03       23 阅读
  14. Android C++系列:Linux进程间关系

    2024-07-13 23:42:03       21 阅读