QPropertyAnimation移动动画小Demo
2017-08-11 14:10
183 查看
先看看效果:
关键代码:
#include <QPropertyAnimation>
QPropertyAnimation *m_leftAnimation;
QPropertyAnimation *m_rightAnimation;
m_leftAnimation = new QPropertyAnimation(ui->lab_left,"pos");
m_rightAnimation = new QPropertyAnimation(ui->lab_right,"pos");
int duration = 2000;
m_leftAnimation->setDuration(duration);
m_rightAnimation->setDuration(duration);
m_leftAnimation->setStartValue(QPoint(0,0));
m_leftAnimation->setEndValue(QPoint(-width/2,0));
m_rightAnimation->setStartValue(QPoint(width/2,0));
m_rightAnimation->setEndValue(QPoint(width,0));
m_leftAnimation->setEasingCurve(QEasingCurve::InOutCirc);
m_rightAnimation->setEasingCurve(QEasingCurve::InOutCirc);
m_leftAnimation->start();
m_rightAnimation->start();
关键代码:
#include <QPropertyAnimation>
QPropertyAnimation *m_leftAnimation;
QPropertyAnimation *m_rightAnimation;
m_leftAnimation = new QPropertyAnimation(ui->lab_left,"pos");
m_rightAnimation = new QPropertyAnimation(ui->lab_right,"pos");
int duration = 2000;
m_leftAnimation->setDuration(duration);
m_rightAnimation->setDuration(duration);
m_leftAnimation->setStartValue(QPoint(0,0));
m_leftAnimation->setEndValue(QPoint(-width/2,0));
m_rightAnimation->setStartValue(QPoint(width/2,0));
m_rightAnimation->setEndValue(QPoint(width,0));
m_leftAnimation->setEasingCurve(QEasingCurve::InOutCirc);
m_rightAnimation->setEasingCurve(QEasingCurve::InOutCirc);
m_leftAnimation->start();
m_rightAnimation->start();
相关文章推荐
- iOS--动画demo--Launch Image淡出效果
- 使用贝赛尔曲线画扇形、圆形、弧线、多边形,实现App下载时的动画效果demo
- JQuery 列队动画 demo
- 快速制作演示动画的工具TurboDemo常见问题合集(二)
- CSS3动画常用demo
- iOS开发>学无止境 - 自定义控制器转场动画及实现下拉菜单的小Demo
- Android动画学习Demo(3) 关于Property Animation的TimeInpolator和TypeEvaluator
- 开源一个动画demo
- Oc 动画MermaidSwimming(美人鱼游泳)~demo
- jquery移动动画的Demo
- jQuery实现的给图片点赞+1动画效果(附在线演示及demo源码下载)
- [iOS 多线程 & 网络 - 3.0] - 在线动画Demo
- iOS小demo之弹出动画
- Android Animation 动画Demo(Frame逐帧动画)
- 一个动画弹出框的 DEMO
- ObjectAnimator属性动画应用demo
- 3D动画效果照片墙demo
- iOS 各种学习资源demo链接汇总 (包含刷新,动画,图表,对话框等效果)
- 【demo练习三】:图片水平滚动、点击按钮变更图片动画
- demo之梦【传说中的64k动画呗、电脑艺术】