Ejemplo n.º 1
0
 def centerOnAnimated(self, centerOn, animate=0):
     """
     Animates the centering options over a given number of seconds.
     
     :param      centerOn | <QRectF> | <QPointF> | <XNode>
                 animate  | <float> | seconds
     """
     if isinstance(centerOn, XNode):
         center = centerOn.sceneRect().center()
     elif isinstance(centerOn, QRectF):
         center = centerOn.center()
     elif isinstance(centerOn, QPointF):
         center = centerOn
     else:
         return
     
     anim = XObjectAnimation(self, 'centerOn', self)
     anim.setStartValue(self.viewportRect().center())
     anim.setEndValue(center)
     anim.setDuration(1000 * animate)
     anim.start()
     anim.finished.connect(anim.deleteLater)
Ejemplo n.º 2
0
    def centerOnAnimated(self, centerOn, animate=0):
        """
        Animates the centering options over a given number of seconds.
        
        :param      centerOn | <QRectF> | <QPointF> | <XNode>
                    animate  | <float> | seconds
        """
        if isinstance(centerOn, XNode):
            center = centerOn.sceneRect().center()
        elif isinstance(centerOn, QRectF):
            center = centerOn.center()
        elif isinstance(centerOn, QPointF):
            center = centerOn
        else:
            return

        anim = XObjectAnimation(self, 'centerOn', self)
        anim.setStartValue(self.viewportRect().center())
        anim.setEndValue(center)
        anim.setDuration(1000 * animate)
        anim.start()
        anim.finished.connect(anim.deleteLater)