当前位置:网站首页>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();}
边栏推荐
- 06 【生命周期 模板引用】
- 地平线:面向规模化量产的智能驾驶系统和软件开发
- Lasso regression (Stata)
- ARM Architecture 3: Addressing and Exception Handling of ARM Instructions
- BUUCTF problem solving PWN 】 【 record (4-6 pages continuously updated)
- 关于判断单峰数组的几种方法
- shell iterates over folders and outputs
- 线程池的基本概念、结构、类
- Singleton pattern base class
- 属性动画QPropertyAnimation
猜你喜欢
JWT:拥有我,即拥有权力
10 【异步组件 组合式函数(hooks)】
并查集学习
shell遍历文件夹并输出
ARM Architecture 3: Addressing and Exception Handling of ARM Instructions
Defending risks with technology and escorting cloud native | Tongchuang Yongyi X Boyun held a joint product launch conference
第三章 搜索与图论(三)
郭晶晶家的象棋私教,好家伙是个机器人
How to use [jmeter regular expression extractor] to solve the problem of returning the value as a parameter
90.(cesium之家)cesium高度监听事件
随机推荐
俄罗斯宣布临时禁止进口摩尔多瓦植物产品
钻石价格预测的ML全流程!从模型构建调优道部署应用!
Fourier series and Fourier transform
"Microservice Architecture" Arrangement and Choreography - Different Models for Making Systems Work Together
Guo Jingjing's personal chess teaching, the good guy is a robot
亚信AntDB数据库有啥业务应用场景和应用案例?
Defending risks with technology and escorting cloud native | Tongchuang Yongyi X Boyun held a joint product launch conference
多线程浅谈
[Data Architecture] Distributed Data Grid as a Solution for Centralized Data Monolith
凭借这份阿里架构师的万字面试手册,逆风翻盘,斩获阿里offer
在“企业通讯录”的盲区,融云的边界与分寸
地平线:面向规模化量产的智能驾驶系统和软件开发
Basic concepts of concurrency, operations, containers
FPGA时钟篇(一) 7系列的时钟结构
How to understand the difference between BIO, NIO, and AIO
Hugo NexT主题升级记录
【微服务架构】为故障设计微服务架构
「数据架构」:主数据管理(MDM)对我的行业有什么帮助?
如何理解BIO、NIO、AIO的区别
日期类(暑假每日一题 19)