Qt 简单动画demo
来源:互联网 发布:linux命令行退出全屏 编辑:程序博客网 时间:2024/05/16 11:20
//组合动画 this->setWindowFlags(Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint); //无边框 this->setAttribute(Qt::WA_TranslucentBackground, true); this->setGeometry(QApplication::desktop()->frameGeometry()); QRect availableGeometry = QApplication::desktop()->availableGeometry(); QLabel *temp = new QLabel(this); temp->setGeometry(this->geometry()); temp->setPixmap(m_pixmap); QSize size = this->size(); int m_duration = 800; //位置 QPropertyAnimation *posAnimation = new QPropertyAnimation(temp, "pos"); connect(posAnimation,SIGNAL(finished()),this,SLOT(close())); posAnimation->setDuration(m_duration); posAnimation->setKeyValueAt(0,QPoint(0,0)); posAnimation->setKeyValueAt(0.15, QPoint(size.width()*0.09,size.height()*0.01)); posAnimation->setKeyValueAt(0.5, QPoint(size.width()*0.25,size.height()*0.1)); posAnimation->setKeyValueAt(0.8, QPoint(size.width()*0.45,size.height()*0.5)); posAnimation->setKeyValueAt(1, QPoint(size.width()*0.5,size.height())); posAnimation->setEndValue(QPoint(size.width()*0.5-25,availableGeometry.height()-111)); posAnimation->setEasingCurve(QEasingCurve::OutInQuad); posAnimation->start(); //大小 QPropertyAnimation *SizeAnimation = new QPropertyAnimation(temp, "size"); QRect rect = this->rect(); SizeAnimation->setDuration(m_duration); SizeAnimation->setKeyValueAt(0,QSize(rect.width(),rect.height())); SizeAnimation->setKeyValueAt(1, QSize(50,50)); SizeAnimation->setEndValue(QSize(50,50)); posAnimation->setEasingCurve(QEasingCurve::OutInQuad); SizeAnimation->start(); //透明度 QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect(); m_section_btn->hide(); m_all_btn->hide(); m_setting_btn->hide(); m_return_btn->hide(); opacityEffect->setOpacity(1); temp->setGraphicsEffect(opacityEffect); QPropertyAnimation *opacityAnimation = new QPropertyAnimation(opacityEffect, "opacity"); connect(opacityAnimation,SIGNAL(finished()),this,SLOT(close())); opacityAnimation->setDuration(m_duration); opacityAnimation->setStartValue(0.8); opacityAnimation->setEndValue(0.4); opacityAnimation->start();
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
大小QPropertyAnimation *animation = new QPropertyAnimation(temp, "size");connect(animation,SIGNAL(finished()),this,SLOT(close()));QRect rect = this->rect();animation->setDuration(3000);animation->setKeyValueAt(0,QSize(rect.width(),rect.height()));animation->setKeyValueAt(1, QSize(rect.width()/2,rect.height()/2));animation->setEndValue(QSize(rect.width()/2,rect.height()/2));animation->start();----------------------------------------------------------------非子窗口的透明度设置QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect();opacityEffect->setOpacity(1);temp->setGraphicsEffect(opacityEffect);QPropertyAnimation *animation1 = new QPropertyAnimation(opacityEffect, "opacity");connect(animation1,SIGNAL(finished()),this,SLOT(close()));animation1->setDuration(2000);animation1->setStartValue(1);animation1->setEndValue(0.5);animation1->start();--------坐标-------------------------------------------/*QPropertyAnimation *animation = new QPropertyAnimation(temp, "geometry");//connect(animation,SIGNAL(finished()),this,SLOT(close()));QRect rect = this->rect();animation->setDuration(2000);animation->setKeyValueAt(0,this->rect());animation->setKeyValueAt(0.2,QRect(rect.width()*0.4,50,rect.width()/2,rect.height()/2));animation->setKeyValueAt(0.4,QRect(rect.width()*0.3,50+rect.width()*0.1,rect.width()*0.4,rect.height()*0.4));animation->setKeyValueAt(0.6,QRect(rect.width()*0.15,50+rect.width()*0.25,rect.width()*0.3,rect.height()*0.3));animation->setKeyValueAt(0.8,QRect(70,50+rect.width()*0.45,rect.width()*0.2,rect.height()*0.2));animation->setKeyValueAt(1, QRect(50,availableGeometry.height()-30,50, 50));animation->setEndValue(QRect(50,availableGeometry.height()-111,70, 70));animation->start();animation->setEasingCurve(QEasingCurve::InOutQuad);*/
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
透明度
QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); animation->setDuration(300); animation->setStartValue(0); animation->setEndValue(1); animation->start();
0 0
- Qt 简单动画demo
- swift简单动画demo
- Unity3D一个简单的动画混合Demo
- 基于HTML5的简单游戏动画Demo
- Android 帧动画 FrameAnimation 简单DEMO
- Android 补件动画 TweenAnimation 简单DEMO
- 简单的四种动画Demo
- Qt窗口的消失简单动画
- 【转】Qt动画组的简单使用
- 动画demo
- QT Demo
- 命令模式demo-一个简单的动画回放功能
- Qt+VLC简单的使用显示视频Demo
- Qt在Windows上简单调用opencv摄像头Demo
- Qt + Opencv 实现的一个简单文字识别的demo
- Qt动画
- QT动画
- Qt动画
- Struts2实现文件上传和下载
- 你应该知道的 RPC 原理
- 简单分享下阿里面试经验
- Glide 一个专注于平滑滚动的图片加载和缓存库
- ReactNative官网例子练习(四)——页面跳转
- Qt 简单动画demo
- Linux的SSH原理以及Putty配置sshkey
- 敏捷项目管理--流程管理
- 需要关注的技术网站 & 不错的个人博客站点
- 移动
- Linux下的环境变量
- 差分约束系统
- 从安卓的Looper到iOS的RunLoop
- VS2015,matlab2016混合编程