当前位置:网站首页>Property animation QPropertyAnimation
Property animation QPropertyAnimation
2022-08-10 09:37:00 【Lee Neo】
widget.h
#include "widget.h"#include "ui_widget.h"#include #include Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){ui->setupUi(this);propertyAnimation = new QPropertyAnimation(ui->geometryWidget,"geometry");//Set the animation start value, key value, and end value;propertyAnimation->setStartValue(QRect(0,0,100,100));propertyAnimation->setKeyValueAt(0.5,QRect(0,400,200,200));propertyAnimation->setEndValue(QRect(600,400,200,200));//Set the animation often;propertyAnimation->setDuration(2000);//Set the animation cycle;propertyAnimation->setLoopCount(1);//Set animation easing curve; animation motion speed curve;propertyAnimation->setEasingCurve(QEasingCurve::InOutCubic);//set color animation;QGraphicsColorizeEffect *graphicsColorizeEffect = new QGraphicsColorizeEffect(this);ui->colorWidget->setGraphicsEffect(graphicsColorizeEffect);propertyAnimation1 = new QPropertyAnimation(graphicsColorizeEffect,"color");propertyAnimation1->setStartValue(QColor(Qt::black));propertyAnimation1->setEndValue(QColor(Qt::red));propertyAnimation1->setDuration(4000);// opacity animationQGraphicsOpacityEffect *graphicsOpacityEffect = new QGraphicsOpacityEffect(this);ui->colorWidget->setGraphicsEffect(graphicsOpacityEffect);propertyAnimation2 = new QPropertyAnimation(graphicsOpacityEffect,"opacity");propertyAnimation2->setStartValue(0.0);propertyAnimation2->setEndValue(1.0);propertyAnimation2->setDuration(2000);}Widget::~Widget(){delete ui;}void Widget::on_pushButton_clicked(){propertyAnimation->start();propertyAnimation2->start();}void Widget::on_pushButton_2_clicked(){propertyAnimation1->start();}
边栏推荐
猜你喜欢
09 【Attributes继承 provide与inject】
UE4 Sequence添加基础动画效果 (05-蓝图触发Sequence)
The first offline workshop in 2022!Data application experience day for application developers is coming | TiDB Workshop Day
Lasso回归(Stata)
Chapter 3 Search and Graph Theory (3)
腾讯发布四足机器人 Max 二代版本,梅花桩上完成跳跃、空翻
FPGA时钟篇(二) 7系列clock region详解
FPGA中BEL Site Tile FSR SLR分别指什么?
CAD转WPF: 关于CAD图纸文件转换为WPF矢量代码文件(xaml文件)的技巧
CAD to WPF: Tips on converting CAD drawing files to WPF vector code files (xaml files)
随机推荐
《广州市公路工程安全生产监督管理办法》印发,从六大方面进行修订
用高质量图像标注数据加速AI商业化落地
Singleton pattern base class
钻石价格预测的ML全流程!从模型构建调优道部署应用!
jq封装树形下拉选择框组件
Tencent releases the second-generation version of the quadruped robot Max, which completes jumps and somersaults on the plum blossom pile
对称加密与非对称加密的区别
shell------常用小工具,sort,uniq,tr,cut
MUDA:对齐特定域的分布和分类器以实现来自多源域的跨域分类
BUUCTF problem solving PWN 】 【 record (4-6 pages continuously updated)
多线程知识点总结之温故而知新
keepalived:主备配置
mysql千万级别数据库优化
Fourier series and Fourier transform
Optimistic and pessimistic locking
【数据库架构】OLTP 和 OLAP:实际比较
【软考 系统架构设计师】系统可靠性分析与设计① 系统可靠性分析
单例模式基类
属性动画QPropertyAnimation
【API架构】使用 JSON API 的好处