PyQt5 (一百零五)用动画效果不同速度的移动窗口 案例

PyQt5 用动画效果不同速度的移动窗口 案例

import sys

from PyQt5.QtCore import Qt, QRect, QPropertyAnimation, QParallelAnimationGroup, QEasingCurve, QSequentialAnimationGroup
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QHBoxLayout, QPushButton, QMessageBox, QApplication, QVBoxLayout, QWidget, \
    QLabel, QGridLayout, QLineEdit, QTextEdit, QFormLayout, QComboBox, QMainWindow

from CommonHelper import CommonHelper
'''
PyQt5 用动画效果不同速度的移动窗口 案例

'''

app = QApplication(sys.argv)

window1 = QMainWindow()
window1.show()

window2 = QMainWindow()
window2.show()

animation1 = QPropertyAnimation(window1,b'geometry')
animation2 = QPropertyAnimation(window2,b'geometry')

# group = QParallelAnimationGroup() # 并行,同时开始
group = QSequentialAnimationGroup() # 一个结束后另一个才开始

group.addAnimation(animation1)
group.addAnimation(animation2)

animation1.setDuration(3000)
animation1.setStartValue(QRect(0,0,100,30))
animation1.setEndValue(QRect(300,300,100,30))
animation1.setEasingCurve(QEasingCurve.OutBounce)

animation2.setDuration(4000)
animation2.setStartValue(QRect(300,200,100,30))
animation2.setEndValue(QRect(900,300,100,30))
animation2.setEasingCurve(QEasingCurve.OutBounce)

group.start()

sys.exit(app.exec())

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值