Qt动画框架-(3)分组动画
来源:互联网 发布:正则表达式 手机号js码 编辑:程序博客网 时间:2024/06/05 20:17
这一节简单介绍分组动画
准备工作
Widget w; TransparentWidget t; //透明窗体 QLabel pix; QPushButton btn("一个按钮"); pix.setPixmap(QPixmap("E:/pic/poi2.jpg")); pix.setParent(&w); w.addItem(&pix); w.show(); btn.setParent(&t); t.addItem(&btn); t.show();
其中透明窗体可以参考,我的另一篇文章:Qt透明窗体
http://blog.csdn.net/gx864102252/article/details/72779801
图1 显示图片和按钮
- 分组动画
QPropertyAnimation animation1(&w, "geometry"); QPropertyAnimation animation2(&t, "geometry"); QParallelAnimationGroup group; group.addAnimation(&animation1); group.addAnimation(&animation2); QDesktopWidget desktop; animation1.setDuration(2000); animation1.setStartValue(QRect(desktop.width() / 2, desktop.height() / 2, pix.width(), pix.height())); animation1.setEndValue(QRect(desktop.width() / 2, 0, pix.width(), pix.height())); animation2.setDuration(4000); animation2.setStartValue(QRect(desktop.width() / 2, desktop.height() / 2, pix.width(), pix.height())); animation2.setEndValue(QRect(desktop.width() / 2, 0, pix.width(), pix.height())); animation2.setEasingCurve(QEasingCurve::OutBounce); group.start();
依旧是从屏幕中心运动到最上方,按钮运动4s,图片运动2s,按钮设置了曲线动画
图2 分组动画
分组中的每个动画都是独立的
- 顺序动画
QSequentialAnimationGroup将按顺序播放动画。它在上一个完成后,在列表中开始下一个动画。
图3 顺序动画
由于动画组是动画本身(组合模式 Composite Pattern),因此您可以将其添加到另一个组。通过这种方式,您可以构建一个动画的树形结构,该动画指定动画何时相互影响。
有关状态机的动画相关后期继续更新
阅读全文
0 0
- Qt动画框架-(3)分组动画
- Qt动画框架
- QT动画框架
- Qt动画框架
- Qt动画框架详解
- QT动画框架
- Qt动画框架
- Qt动画框架详解
- Qt 动画框架
- Qt动画框架
- Qt动画框架
- 【Qt动画框架】
- Qt之动画框架
- QT动画框架
- Qt动画框架
- Qt动画框架
- Qt动画框架的实现
- Qt动画框架--原创翻译
- 缓存策略交互 — 最长使用期限和最长过期时间
- 【数据库-MySql】函数
- 索引查询
- SpringMVC的拦截器(Interceptor)和过滤器(Filter)详解
- hadoop入门级总结二:Map/Reduce
- Qt动画框架-(3)分组动画
- よくある例外型
- 31个Android 开发者工具
- Makefile教程
- Android学习二、MediaPlayer播放视频
- 八段锦健身养生功法介绍
- hadoop入门级总结一:HDFS
- 用Caffe自带程序画网络结构图
- Spring MVC 请求响应流程