QML--states 与 transitions动画制作

    Rectangle {
        id: root
        width: 100; height: 100
        state: "blue_color"
        states: [
            State {
                name: "red_color"
                PropertyChanges { target: root; color: "red" }
            },
            State {
                name: "blue_color"
                PropertyChanges { target: root; color: "blue" }
            }
        ]

        MouseArea {
            anchors.fill: parent
            onPressed: {
                root.state = "red_color"
            }
            onReleased: {
                root.state = "blue_color"
            }
        }
    }

展现效果:默认蓝色,鼠标点击显示红色,释放显示蓝色
在这里插入图片描述

    Rectangle {
        id: flashingblob
        width: 75;
        height: 75
        color: "blue"
        opacity: 1.0

        MouseArea {
            anchors.fill: parent
            onClicked: {
                animateColor.start()
                animateOpacity.start()
            }
        }

        PropertyAnimation {
            id: animateColor;
            target: flashingblob;
            properties: "color";
            to: "green";
            duration: 1000
        }

        NumberAnimation {
            id: animateOpacity
            target: flashingblob
            properties: "opacity"
            from: 0.1
            to: 1.0
            duration: 2000
            //loops: Animation.Infinite
            //easing {type: Easing.OutBack; overshoot: 500}
       }
    }

展示效果:由蓝变绿,时间1s,透明度由0.1 到 1
在这里插入图片描述

    Rectangle {
        id: rect
        width: 100; 
        height: 100
        color: "red"

        PropertyAnimation on x { 
            to: 100 
        }
        PropertyAnimation on y {
            to: 100 
        }//移动位置
        SequentialAnimation on color {
            ColorAnimation {
                to: "red"
                duration: 1000
            }
            ColorAnimation {
                to: "blue"
                duration: 1000
            }
        }//执行队列
    }

展现效果:从0位置移动到 100,100 的位置,再持续一秒红色,变成蓝色

在这里插入图片描述

Rectangle {
      width: 75; height: 75
      id: button
      state: "RELEASED"

      MouseArea {
          anchors.fill: parent
          onPressed: button.state = "PRESSED"
          onReleased: button.state = "RELEASED"
      }

      states: [
          State {
              name: "PRESSED"
              PropertyChanges { target: button; color: "lightblue"}
          },
          State {
              name: "RELEASED"
              PropertyChanges { target: button; color: "lightsteelblue"}
          }
      ]

      transitions: [
          Transition {
              from: "PRESSED"
              to: "RELEASED"
              ColorAnimation { target: button; duration: 100}
          },
          Transition {
              from: "RELEASED"
              to: "PRESSED"
              ColorAnimation { target: button; duration: 100}
          }
      ]
  }

展现效果:达到渐变的效果,点击释放,释放点击的过程
在这里插入图片描述

Rectangle {
      width: 75; height: 75; radius: width
      id: ball
      color: "salmon"
	
	  MouseArea{
			anchors.fill: parent
			onClicked:{
				ball.x += 50
				ball.x += 40
		}
	  }
      Behavior on x {
          NumberAnimation {
              id: bouncebehavior
              easing {
                  type: Easing.OutElastic
                  amplitude: 1.0
                  period: 0.5
              }
          }
      }
      Behavior on y {
          animation: bouncebehavior
      }
      Behavior {
          ColorAnimation { target: ball; duration: 100 }
      }
  }

展现效果:x或y值变化的一个行为动作
在这里插入图片描述

    Rectangle {
        id: banner
        width: 150; height: 100; border.color: "black"

        Column {
            anchors.centerIn: parent
            Text {
                id: code
                text: "Code less."
                opacity: 0.01
            }
            Text {
                id: create
                text: "Create more."
                opacity: 0.01
            }
            Text {
                id: deploy
                text: "Deploy everywhere."
                opacity: 0.01
            }
        }

        MouseArea {
            anchors.fill: parent
            onPressed: playbanner.start()
        }

        SequentialAnimation {
            id: playbanner
            running: false
            NumberAnimation { target: code; property: "opacity"; to: 1.0; duration: 1000}
            NumberAnimation { target: create; property: "opacity"; to: 1.0; duration: 1000}
            NumberAnimation { target: deploy; property: "opacity"; to: 1.0; duration: 1000}
        }
    }

展现效果:延时一秒,展示一行文本
在这里插入图片描述

  • 9
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: QML-QianWindow-V1版本界面是一款用户界面设计程序,它为开发人员提供了大量可自定义的UI组件,使得开发者可以轻松地创建美观、直观且易于使用的界面。QML-QianWindow-V1版本界面具有界面美观,易用性强以及可扩展性强的特点。该程序提供了多种UI组件如窗口、按钮、文本框、下拉框、进度条等等。每个组件都可以基于开发需求进行个性化设计,提高了程序的可读性和可维护性。 QML-QianWindow-V1版本界面的窗口设计功能令人称赞。用户可以定制窗口的样式、位置和大小等属性,使其符合自己的需求。同时,该程序支持类似IOS与Android风格的Tab、Panel、Dialog等视图控件,让应用的界面更具丰富性和交互性,提升用户体验。 此外,QML-QianWindow-V1版本界面可让用户通过实用的数据模型,快速地创建和管理表格和列表,包括多行、多列的表格和单选或多选列表,使得用户可以方便地处理大量数据。 总之,QML-QianWindow-V1版本界面通过提供易用性和可扩展性强的UI组件来简化界面设计过程,使得开发人员可以迅速开发出优秀的桌面应用程序界面,以满足用户高品质的界面需求。 ### 回答2: QML-Qianwindow-v1版本是一款基于QML语言开发的桌面应用程序,其主要特点是界面设计美观、简单易用,适用于多种应用场景。 该软件的主界面包含五个主要区域:侧边栏、消息中心、主视图、小部件和设置菜单。 侧边栏主要用于导航,其中包含主要的应用程序和功能,使用户可以轻松地进入不同的模块。 消息中心用于显示来自其他应用程序的通知,例如电子邮件或要完成的任务。 主视图是QML-Qianwindow-v1的核心区域,其中包含常见的功能和工具,例如打开的文件、书签和搜索栏。 小部件区域用于显示用户选择的小部件,例如天气预报和日历。 设置菜单区域包含应用程序的设置菜单,用户可以在此处更改应用程序的选项、主题和常规设置。 总体来说,QML-Qianwindow-v1版本的界面设计非常简洁,用户友好,易于使用。它增强了用户的生产力和效率,为用户提供了一种令人愉悦的使用体验。 ### 回答3: QML-QianWindow-v1是一种基于Qt QML开发的简单易用的窗口界面库。其设计风格简洁明了,适用于各种桌面应用开发。 该库主要由三个部分组成:Title Bar、Main Body和Sidebar。其中,Title Bar是窗口的标题栏,可以自定义标题、图标、按钮、菜单等。Main Body是页面的主体内容,可以显示各种控件、窗口和布局。Sidebar是侧边栏,可以显示常用的菜单、工具、快捷方式等。 在QML-QianWindow-v1中,可以使用QianWindow来创建窗口。QianWindow提供了常用的窗口操作方法,例如最小化、最大化、关闭等。同时,该库还提供了很多常用的QML组件,例如按钮、文本框、下拉框、列表框等,这些组件可以方便快捷地进行页面设计。此外,在QML-QianWindow-v1中还支持自定义样式,可以根据需要修改组件的颜色、形状、大小等。 QML-QianWindow-v1的界面设计风格简洁明了,同时具有一定的美观度。尤其是Title Bar部分的设计非常灵活,可以根据需要自由定制。Main Body部分支持多种布局方式,可以满足不同页面设计的需求。Sidebar部分则提供了丰富的快捷操作方式,提高了用户的使用效率。 总的来说,QML-QianWindow-v1是一款非常实用的界面库,可以方便快捷地进行桌面应用开发。无论是初学者还是有经验的开发者,都可以轻松使用该库进行界面设计。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

C葭葭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值