Qt provides us with serval different sub-systems to create animation for our GUI, including
timer, timeline, animation framework, state machine framework, and graphics view framework.
Qt里面运动可以用
timer时钟,timeline时间轴,animation framework动作框架,state machine framework状态机和graphics view framework图形框架
等方式来实现。
1。Timer:
Timer: Qt provides us with repetitive and single-short timers.When the timeout value is reached, an event callback function will
be triggered through Qt's signal-and-slot mechanism. You can make use of a timer to change the properties(color, position, scale,
and so on) of your GUI element within a given interval to create an animtion.
其它的GUI界面库也用到时钟来执行时间序列动作。
2。Timeline
Timeline: Timeline calls a slot periodically to animation a GUI element. It is quite similar to a repetitive timer, but instead of doing the
same thing all of the time when the slot is triggered, timeline provides a value to the slot to indicate its current frame index so that you
can do different things(such as offset to a different space of the sprite sheet) based on the given value.
时间轴方式和时钟方式差不多,多了各个时间点控制值。
3。Animation framework
Animation framework: The animation framework makes animating a GUI element easy by allowing its properties bo be animated.
The animations are controlled by using easing curves. Easing curves describe a function that controls what the speed of the
animation should be, resulting in different acceleration and deceleration patterns. The types of easing curve supported by
Qt include linear, quadratic, cubic, quartic, sine, exponential, circular, and elastic.
动作框架可以方便使用内置的easing curves动作曲线函数来实现各种物理学动作。
4。Graphics view framework
Graphics view framework: The graphics view framework is a powerful graphics engine for visualizing and interacting with a large number of
custom-make 2D graphical items. You can use the graphics view framework to draw your GUI and have them animated in a totally manual
way if you are an experienced programmer.
绘图框架功能最强大了,也是以后用到的。
多谢,亲爱的美美。