[QtGui module]
该QGraphicsItemAnimation类提供了简单的动画支持QGraphicsItem。More…
继承QObject。
Methods
__init__ (self, QObject parent = None)
afterAnimationStep (self, float step)
beforeAnimationStep (self, float step)
clear (self)
float horizontalScaleAt (self, float step)
float horizontalShearAt (self, float step)
QGraphicsItem item (self)
QMatrix matrixAt (self, float step)
QPointF posAt (self, float step)
list-of-tuple-of-float-QPointF posList (self)
reset (self)
float rotationAt (self, float step)
list-of-tuple-of-float-float rotationList (self)
list-of-tuple-of-float-QPointF scaleList (self)
setItem (self, QGraphicsItem item)
setPosAt (self, float step, QPointF pos)
setRotationAt (self, float step, float angle)
setScaleAt (self, float step, float sx, float sy)
setShearAt (self, float step, float sh, float sv)
setStep (self, float x)
setTimeLine (self, QTimeLine timeLine)
setTranslationAt (self, float step, float dx, float dy)
list-of-tuple-of-float-QPointF shearList (self)
QTimeLine timeLine (self)
list-of-tuple-of-float-QPointF translationList (self)
float verticalScaleAt (self, float step)
float verticalShearAt (self, float step)
float xTranslationAt (self, float step)
float yTranslationAt (self, float step)
Detailed Description
该QGraphicsItemAnimation类提供了简单的动画支持QGraphicsItem。
该QGraphicsItemAnimation类一个动画QGraphicsItem。您可以在指定的步骤安排变更项目的变换矩阵。该QGraphicsItemAnimation类具有电流步长值。当这个值改变安排在该步骤的转换执行。动画的当前步骤设置与setStep()
功能。
QGraphicsItemAnimation会做一个简单的线性插值最邻近的预定变化的计算矩阵。例如,如果你设置为值0.0和1.0的项目的位置,动画会显示该项目活动在这些位置之间的直线。同样是真实的缩放和旋转。
这是通常使用的类与QTimeLine。时间轴的valueChanged()信号,然后连接到setStep()
插槽。例如,您可以设置旋转的项目通过调用setRotationAt()
针对不同的步长值。动画时间轴设定与setTimeLine()函数。
一个例子动画时间轴如下:
[QGraphicsItem](docs_qgraphicsitem.html) *ball = new [QGraphicsEllipseItem](docs_qgraphicsellipseitem.html)(0, 0, 20, 20);
[QTimeLine](docs_qtimeline.html) *timer = new [QTimeLine](docs_qtimeline.html)(5000);
timer->setFrameRange(0, 100);
QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
animation->setItem(ball);
animation->setTimeLine(timer);
for (int i = 0; i < 200; ++i)
animation->setPosAt(i / 200.0, [QPointF](docs_qpointf.html)(i, i));
[QGraphicsScene](docs_qgraphicsscene.html) *scene = new [QGraphicsScene](docs_qgraphicsscene.html)();
scene->setSceneRect(0, 0, 250, 250);
scene->addItem(ball);
[QGraphicsView](docs_qgraphicsview.html) *view = new [QGraphicsView](docs_qgraphicsview.html)(scene);
view->show();
timer->start();
注意,步骤在于在0.0和1.0之间。可能有必要使用setUpdateInterval()。默认的更新间隔为40毫秒。当一个预定的改造不能被删除,所以安排在同一步骤同一种(例如,旋转)的几个转变,不推荐。
Method Documentation
QGraphicsItemAnimation.__init__ (self, QObject parent = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个动画对象与给定parent。
QGraphicsItemAnimation.afterAnimationStep (self, float step)
这个方法是在需要一个新的台阶已经发生之后执行额外的代码子类重写。动画step提供了一种用于使用的情况下的操作取决于它的值。
QGraphicsItemAnimation.beforeAnimationStep (self, float step)
这个方法是由子类需要执行额外的代码了新的一步发生之前被复盖。动画step提供了一种用于使用的情况下的操作取决于它的值。
QGraphicsItemAnimation.clear (self)
清除用于动画预定转换,但保留的项目和时间安排。
float QGraphicsItemAnimation.horizontalScaleAt (self, float step)
返回水平规模的项目在指定的step值。
See also setScaleAt( ) 。
float QGraphicsItemAnimation.horizontalShearAt (self, float step)
返回水平剪切的项目在指定的step值。
See also setShearAt( ) 。
QGraphicsItem QGraphicsItemAnimation.item (self)
[
返回动画对象所操作的项目。
](docs_qgraphicsitem.html)
QMatrix QGraphicsItemAnimation.matrixAt (self, float step)
[
返回用于改造项目在指定的矩阵step值。
](docs_qmatrix.html)
QPointF QGraphicsItemAnimation.posAt (self, float step)
[
返回在给定项目的位置step值。
](docs_qpointf.html)
list-of-tuple-of-float-QPointF QGraphicsItemAnimation.posList (self)
返回所有显式地插入位置。
See also posAt()和setPosAt( ) 。
QGraphicsItemAnimation.reset (self)
这种方法也是一个Qt槽与C + +的签名void reset()
。
float QGraphicsItemAnimation.rotationAt (self, float step)
返回在该项目旋转指定的角度step值。
See also setRotationAt( ) 。
list-of-tuple-of-float-float QGraphicsItemAnimation.rotationList (self)
返回所有显式地插入旋转。
See also rotationAt()和setRotationAt( ) 。
list-of-tuple-of-float-QPointF QGraphicsItemAnimation.scaleList (self)
返回所有显式地插入尺度。
See also verticalScaleAt( )horizontalScaleAt()和setScaleAt( ) 。
QGraphicsItemAnimation.setItem (self, QGraphicsItem item)
设置指定item在动画中使用。
See also item( ) 。
QGraphicsItemAnimation.setPosAt (self, float step, QPointF pos)
设置在给定项目的位置step值到point规定。
See also posAt( ) 。
QGraphicsItemAnimation.setRotationAt (self, float step, float angle)
设置项的旋转在给定的step值到angle规定。
See also rotationAt( ) 。
QGraphicsItemAnimation.setScaleAt (self, float step, float sx, float sy)
设置项的比例在给定的step重视使用由指定的水平和垂直缩放因子sx和sy。
See also verticalScaleAt()和horizontalScaleAt( ) 。
QGraphicsItemAnimation.setShearAt (self, float step, float sh, float sv)
设置项的剪切在给定的step值通过使用指定的水平和垂直切变的因素sh和sv。
See also verticalShearAt()和horizontalShearAt( ) 。
QGraphicsItemAnimation.setStep (self, float x)
这种方法也是一个Qt槽与C + +的签名void setStep(qreal)
。
设置当前step价值为动画,引起预定在该步骤中要进行的变换。
QGraphicsItemAnimation.setTimeLine (self, QTimeLine timeLine)
设置用来控制动画的速度时间轴对象timeLine规定。
See also timeLine( ) 。
QGraphicsItemAnimation.setTranslationAt (self, float step, float dx, float dy)
设置项的翻译在给定的step值使用由指定的水平和垂直坐标dx和dy。
See also xTranslationAt()和yTranslationAt( ) 。
list-of-tuple-of-float-QPointF QGraphicsItemAnimation.shearList (self)
返回所有显式地插入剪。
See also verticalShearAt( )horizontalShearAt()和setShearAt( ) 。
QTimeLine QGraphicsItemAnimation.timeLine (self)
[
返回用于控制在该动画的发生率在时间轴对象。
](docs_qtimeline.html)
See also setTimeLine( ) 。
list-of-tuple-of-float-QPointF QGraphicsItemAnimation.translationList (self)
返回所有显式地插入翻译。
See also xTranslationAt( )yTranslationAt()和setTranslationAt( ) 。
float QGraphicsItemAnimation.verticalScaleAt (self, float step)
返回该项目的垂直刻度在指定step值。
See also setScaleAt( ) 。
float QGraphicsItemAnimation.verticalShearAt (self, float step)
返回该项目的垂直切变在指定step值。
See also setShearAt( ) 。
float QGraphicsItemAnimation.xTranslationAt (self, float step)
返回该项目的翻译水平在指定的step值。
See also setTranslationAt( ) 。
float QGraphicsItemAnimation.yTranslationAt (self, float step)
返回的项的竖直平移在指定step值。
See also setTranslationAt( ) 。