我试图在屏幕上创建数千个点(qframe),并显示这些点在动画进行时从帧中消失时的移动。到目前为止,我可以做很多点,但必须有一个更好的方法,比创造一千个圆-显然。最重要的是,如何设置动画
def drawing(self):
self.AnimWinInterface.frame.setFrameStyle(QFrame.Panel | QFrame.Raised)
self.AnimWinInterface.frame.setStyleSheet('background-color: rgb(50,50,50)')
self.painter = QPainter(self)
self.painter.setPen(QPen(Qt.red, 8, Qt.SolidLine))
self.painter.setBrush(QBrush(Qt.red, Qt.CrossPattern))
self.painter.drawEllipse(200,200,50,50)
def doAnimation(self):
maxWidth = self.AnimWinWidget.frameGeometry().width()
offset = 50
self.anim1 = QPropertyAnimation(self.AnimWinInterface.frame,b"geometry")
self.anim1.setDuration(50000)
self.anim1.setStartValue(QRect(maxWidth - offset,200 ,100,30))
self.anim1.setEndValue(QRect(offset,200,100,30))
self.group = QSequentialAnimationGroup()
self.group.addanimation(self.anim1)
self.group.start()
暂无答案!
目前还没有任何答案,快来回答吧!