概述
QTimeLine 是一个提供了控制动画的时间轴的类。通常都是通过调用槽函数来控制动画的显示。
QTimeLine在构造函数中,你可以传递一个毫秒级的参数,设定动画的运行时间。如:
- timeline1 = new QTimeLine(1000);
然后你可以设置该动画设置多少帧,如:
- timeline1->setFrameRange(0,100);
这样表示动画分为100帧,然后每帧刷新的时候会产生一个信号,frameChanged(),这样,你就可以通过链接你的槽函数做你想做的事情:
- connect(timeline1,SIGNAL(frameChanged(int)),SLOT(SLOTTimerMove1()));
最后一切准备就绪之后,调用start函数:
- timeLine->start();
- timeline->setCurveShape(QTimeLine::LinearCurve);
函数的参数表示 信号frameChanged以线性的方式发送,当然还有其他的选项:
Constant | Value | Description |
---|---|---|
QTimeLine::EaseInCurve | 0 | The value starts growing slowly, then increases in speed.先慢后快 |
QTimeLine::EaseOutCurve | 1 | The value starts growing steadily, then ends slowly.先匀加速,后减速 |
QTimeLine::EaseInOutCurve | 2 | The value starts growing slowly, then runs steadily, then grows slowly again.先慢,中间稳定,最后慢 |
QTimeLine::LinearCurve | 3 | The value grows linearly (e.g., if the duration is 1000 ms, the value at time 500 ms is 0.5).匀速的 |
QTimeLine::SineCurve | 4 | The value grows sinusoidally.正选曲线式 |
QTimeLine::CosineCurve | 5 | The value grows cosinusoidally.余弦曲线式 |
最后
以上就是健忘御姐为你收集整理的QTimeLine 时间轴类 实现动画的全部内容,希望文章能够帮你解决QTimeLine 时间轴类 实现动画所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复