本文整理汇总了Python中PyQt5.QtCore.QPropertyAnimation.setEasingCurve方法的典型用法代码示例。如果您正苦于以下问题:Python QPropertyAnimation.setEasingCurve方法的具体用法?Python QPropertyAnimation.setEasingCurve怎么用?Python QPropertyAnimation.setEasingCurve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation.setEasingCurve方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MoveSymbol
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
class MoveSymbol(QUndoCommand):
''' Undo/Redo command for moving symbols '''
def __init__(self, symbol_id, old_pos, new_pos, animate=False):
super(MoveSymbol, self).__init__()
self.setText('Move symbol')
self.symbol = symbol_id
self.old_pos = old_pos
self.new_pos = new_pos
if animate:
self.animation = QPropertyAnimation(self.symbol, "position")
self.animation.setDuration(500)
self.animation.setStartValue(self.old_pos)
self.animation.setEndValue(self.new_pos)
self.animation.setEasingCurve(QEasingCurve.OutCirc)
def undo(self):
''' Undo a symbol move '''
self.symbol.position = self.old_pos
try:
self.symbol.decisionParent.updateConnectionPointPosition()
except AttributeError:
pass
def redo(self):
''' Apply a symbol move '''
try:
self.animation.start()
except AttributeError:
self.symbol.position = self.new_pos
try:
self.symbol.decisionParent.updateConnectionPointPosition()
except AttributeError:
pass
示例2: __init__
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
def __init__(self):
super(Robot, self).__init__()
self.setFlag(self.ItemHasNoContents)
self.torsoItem = RobotTorso(self)
self.headItem = RobotHead(self.torsoItem)
self.upperLeftArmItem = RobotLimb(self.torsoItem)
self.lowerLeftArmItem = RobotLimb(self.upperLeftArmItem)
self.upperRightArmItem = RobotLimb(self.torsoItem)
self.lowerRightArmItem = RobotLimb(self.upperRightArmItem)
self.upperRightLegItem = RobotLimb(self.torsoItem)
self.lowerRightLegItem = RobotLimb(self.upperRightLegItem)
self.upperLeftLegItem = RobotLimb(self.torsoItem)
self.lowerLeftLegItem = RobotLimb(self.upperLeftLegItem)
settings = (
# Item Position Rotation Scale
# x y start end
(self.headItem, 0, -18, 20, -20, 1.1),
(self.upperLeftArmItem, -15, -10, 190, 180, 0),
(self.lowerLeftArmItem, 30, 0, 50, 10, 0),
(self.upperRightArmItem, 15, -10, 300, 310, 0),
(self.lowerRightArmItem, 30, 0, 0, -70, 0),
(self.upperRightLegItem, 10, 32, 40, 120, 0),
(self.lowerRightLegItem, 30, 0, 10, 50, 0),
(self.upperLeftLegItem, -10, 32, 150, 80, 0),
(self.lowerLeftLegItem, 30, 0, 70, 10, 0),
(self.torsoItem, 0, 0, 5, -20, 0),
)
animation = QParallelAnimationGroup(self)
for item, pos_x, pos_y, start_rot, end_rot, scale in settings:
item.setPos(pos_x, pos_y)
rot_animation = QPropertyAnimation(item, b"rotation")
rot_animation.setStartValue(start_rot)
rot_animation.setEndValue(end_rot)
rot_animation.setEasingCurve(QEasingCurve.SineCurve)
rot_animation.setDuration(2000)
animation.addAnimation(rot_animation)
if scale > 0:
scale_animation = QPropertyAnimation(item, b"scale")
scale_animation.setEndValue(scale)
scale_animation.setEasingCurve(QEasingCurve.SineCurve)
scale_animation.setDuration(2000)
animation.addAnimation(scale_animation)
animation.setLoopCount(-1)
animation.start()
示例3: CircleObstruction
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
class CircleObstruction(QColorThemedGraphicsObject):
"""
Useful for notifications, I...guess?
"""
def get_thickness(self):
return self._thickness
def set_thickness(self,c):
self._thickness = c
self.update()
thickness = pyqtProperty(float, get_thickness, set_thickness)
def __init__(self, sz, thickness, parent=None):
super(CircleObstruction, self).__init__(parent)
self._sz = sz
self._thickness = thickness
self._color = Qt.blue
def boundingRect(self):
return QRectF(-self._thickness,
-self._thickness,
self._sz + 2*self._thickness,
self._sz + 2*self._thickness)
def paint(self, painter, option, widget):
# painter.setPen(QPen(self._color,
# self._thickness))
painter.setBrush(self._color)
painter.setPen(Qt.NoPen)
painter.drawEllipse(QRectF(
self._sz/2.0 - self._thickness,
self._sz/2.0 - self._thickness,
2*self._thickness,
2*self._thickness,
))
def show_anim(self):
self.anim = QPropertyAnimation(self, "thickness")
self.anim.setDuration(2000)
self.anim.setStartValue(self.get_thickness())
self.anim.setEndValue(50.0)
self.anim.setEasingCurve(QEasingCurve.OutElastic)
self.anim.start()
def hide_anim(self):
self.anim = QPropertyAnimation(self, "thickness")
self.anim.setDuration(500)
self.anim.setStartValue(self.get_thickness())
self.anim.setEndValue(0.0)
self.anim.setEasingCurve(QEasingCurve.InBack)
self.anim.start()
示例4: __init__
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
def __init__(self, size, parent=None):
super(PadNavigator, self).__init__(parent)
self.form = Ui_Form()
splash = SplashItem()
splash.setZValue(1)
pad = FlippablePad(size)
flipRotation = QGraphicsRotation(pad)
xRotation = QGraphicsRotation(pad)
yRotation = QGraphicsRotation(pad)
flipRotation.setAxis(Qt.YAxis)
xRotation.setAxis(Qt.YAxis)
yRotation.setAxis(Qt.XAxis)
pad.setTransformations([flipRotation, xRotation, yRotation])
backItem = QGraphicsProxyWidget(pad)
widget = QWidget()
self.form.setupUi(widget)
self.form.hostName.setFocus()
backItem.setWidget(widget)
backItem.setVisible(False)
backItem.setFocus()
backItem.setCacheMode(QGraphicsItem.ItemCoordinateCache)
r = backItem.rect()
backItem.setTransform(QTransform().rotate(180, Qt.YAxis).translate(-r.width()/2, -r.height()/2))
selectionItem = RoundRectItem(QRectF(-60, -60, 120, 120),
QColor(Qt.gray), pad)
selectionItem.setZValue(0.5)
smoothSplashMove = QPropertyAnimation(splash, b'y')
smoothSplashOpacity = QPropertyAnimation(splash, b'opacity')
smoothSplashMove.setEasingCurve(QEasingCurve.InQuad)
smoothSplashMove.setDuration(250)
smoothSplashOpacity.setDuration(250)
smoothXSelection = QPropertyAnimation(selectionItem, b'x')
smoothYSelection = QPropertyAnimation(selectionItem, b'y')
smoothXRotation = QPropertyAnimation(xRotation, b'angle')
smoothYRotation = QPropertyAnimation(yRotation, b'angle')
smoothXSelection.setDuration(125)
smoothYSelection.setDuration(125)
smoothXRotation.setDuration(125)
smoothYRotation.setDuration(125)
smoothXSelection.setEasingCurve(QEasingCurve.InOutQuad)
smoothYSelection.setEasingCurve(QEasingCurve.InOutQuad)
smoothXRotation.setEasingCurve(QEasingCurve.InOutQuad)
smoothYRotation.setEasingCurve(QEasingCurve.InOutQuad)
smoothFlipRotation = QPropertyAnimation(flipRotation, b'angle')
smoothFlipScale = QPropertyAnimation(pad, b'scale')
smoothFlipXRotation = QPropertyAnimation(xRotation, b'angle')
smoothFlipYRotation = QPropertyAnimation(yRotation, b'angle')
flipAnimation = QParallelAnimationGroup(self)
smoothFlipScale.setDuration(500)
smoothFlipRotation.setDuration(500)
smoothFlipXRotation.setDuration(500)
smoothFlipYRotation.setDuration(500)
smoothFlipScale.setEasingCurve(QEasingCurve.InOutQuad)
smoothFlipRotation.setEasingCurve(QEasingCurve.InOutQuad)
smoothFlipXRotation.setEasingCurve(QEasingCurve.InOutQuad)
smoothFlipYRotation.setEasingCurve(QEasingCurve.InOutQuad)
smoothFlipScale.setKeyValueAt(0, 1.0)
smoothFlipScale.setKeyValueAt(0.5, 0.7)
smoothFlipScale.setKeyValueAt(1, 1.0)
flipAnimation.addAnimation(smoothFlipRotation)
flipAnimation.addAnimation(smoothFlipScale)
flipAnimation.addAnimation(smoothFlipXRotation)
flipAnimation.addAnimation(smoothFlipYRotation)
setVariablesSequence = QSequentialAnimationGroup()
setFillAnimation = QPropertyAnimation(pad, b'fill')
setBackItemVisibleAnimation = QPropertyAnimation(backItem, b'visible')
setSelectionItemVisibleAnimation = QPropertyAnimation(selectionItem, b'visible')
setFillAnimation.setDuration(0)
setBackItemVisibleAnimation.setDuration(0)
setSelectionItemVisibleAnimation.setDuration(0)
setVariablesSequence.addPause(250)
setVariablesSequence.addAnimation(setBackItemVisibleAnimation)
setVariablesSequence.addAnimation(setSelectionItemVisibleAnimation)
setVariablesSequence.addAnimation(setFillAnimation)
flipAnimation.addAnimation(setVariablesSequence)
stateMachine = QStateMachine(self)
splashState = QState(stateMachine)
frontState = QState(stateMachine)
historyState = QHistoryState(frontState)
backState = QState(stateMachine)
frontState.assignProperty(pad, "fill", False)
frontState.assignProperty(splash, "opacity", 0.0)
frontState.assignProperty(backItem, "visible", False)
frontState.assignProperty(flipRotation, "angle", 0.0)
frontState.assignProperty(selectionItem, "visible", True)
backState.assignProperty(pad, "fill", True)
backState.assignProperty(backItem, "visible", True)
backState.assignProperty(xRotation, "angle", 0.0)
#.........这里部分代码省略.........
示例5: NS_Animate
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
class NS_Animate(object):
def __init__(self, scene, x_max, y_max, back_color):
scene = QGraphicsScene(0, 0, x_max, y_max)
scene.setBackgroundBrush(back_color)
color = [Qt.green, Qt.lightGray, Qt.darkYellow, QtGui.QColor.fromRgb(255, 85, 0)]
self.anim_butt = [ QGraphicsRectWidget(color[j]) for j in range(4) ]
for j in range(4):
scene.addItem(self.anim_butt[j])
self.window = QGraphicsView(scene)
self.window.setFrameStyle(0)
self.window.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self.window.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.window.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.machine = QStateMachine()
self.group = QState()
self.timer = QTimer()
self.timer.setInterval(1250)
self.timer.setSingleShot(True)
self.group.entered.connect(self.timer.start)
# set states positions
anim_state_rects = [ [QRect(x_max*xp/6, y_max*yp/4, 8, 8) for xp in range(4)] for yp in range(4) ]
self.states = [ self.createGeometryState(
self.anim_butt[0], anim_state_rects[0][j], self.anim_butt[1], anim_state_rects[1][j],
self.anim_butt[2], anim_state_rects[2][j], self.anim_butt[3], anim_state_rects[3][j],
self.group
) for j in range(4) ]
self.group.setInitialState(self.states[0])
self.animationGroup = QParallelAnimationGroup()
self.anim = QPropertyAnimation(self.anim_butt[3], 'geometry')
self.anim.setDuration(1250)
self.anim.setEasingCurve(QEasingCurve.InBack)
self.animationGroup.addAnimation(self.anim)
self.subGroup = QSequentialAnimationGroup(self.animationGroup)
self.subGroup.addPause(100)
self.anim = QPropertyAnimation(self.anim_butt[2], 'geometry')
self.anim.setDuration(1000)
self.anim.setEasingCurve(QEasingCurve.OutElastic)
self.subGroup.addAnimation(self.anim)
self.subGroup = QSequentialAnimationGroup(self.animationGroup)
self.subGroup.addPause(500)
self.anim = QPropertyAnimation(self.anim_butt[1], 'geometry')
self.anim.setDuration(500)
self.anim.setEasingCurve(QEasingCurve.OutElastic)
self.subGroup.addAnimation(self.anim)
self.subGroup = QSequentialAnimationGroup(self.animationGroup)
self.subGroup.addPause(750)
self.anim = QPropertyAnimation(self.anim_butt[0], 'geometry')
self.anim.setDuration(250)
self.anim.setEasingCurve(QEasingCurve.OutElastic)
self.subGroup.addAnimation(self.anim)
self.stateSwitcher = StateSwitcher(self.machine)
self.group.addTransition(self.timer.timeout, self.stateSwitcher)
for j in range(4):
self.stateSwitcher.addState(self.states[j], self.animationGroup)
self.machine.addState(self.group)
self.machine.setInitialState(self.group)
self.machine.start()
#
def createGeometryState(self, w1, rect1, w2, rect2, w3, rect3, w4, rect4, parent):
result = QState(parent)
result.assignProperty(w1, 'geometry', rect1)
result.assignProperty(w1, 'geometry', rect1)
result.assignProperty(w2, 'geometry', rect2)
result.assignProperty(w3, 'geometry', rect3)
result.assignProperty(w4, 'geometry', rect4)
return result
示例6: CoffeeFundWindow
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
class CoffeeFundWindow(QWidget):
signal_back = pyqtSignal()
signal_coffee = pyqtSignal()
signal_account = pyqtSignal()
def __init__(self, parent=None):
super().__init__()
self.cards = {} # type: Dict[GuiCards, QWidget]
"""
Python's GC will clean up QPropertyAnimations as soon as it leaves the button handler,
therefore they will appear not to work. Use members to store the animations.
see http://stackoverflow.com/a/6953965
"""
self.slide_in_animation = None
self.slide_out_animation = None
self.animation_group = None
self.setObjectName("coffeeFundWindow")
"""
Store the position and size of visible/hidden cards for the animation sequences
"""
self.hidden_geometry = None
self.visible_geometry = None
layout = QStackedLayout()
layout.setStackingMode(QStackedLayout.StackAll)
card_remove = RemoveCard()
self.cards[GuiCards.RemoveCard] = card_remove
layout.addWidget(card_remove)
card_choose_action = ChooseActionCard()
self.cards[GuiCards.ChooseAction] = card_choose_action
layout.addWidget(card_choose_action)
card_account = AccountCard()
self.cards[GuiCards.AccountInfo] = card_account
layout.addWidget(card_account)
# keep this as last initialized card, the last card will be shown on startup!
card_start = StartCard()
self.cards[GuiCards.Start] = card_start
layout.addWidget(card_start)
self.setLayout(layout)
self.setWindowTitle("Kaffeekasse")
layout.setCurrentWidget(card_start)
self.active_card = None
card_choose_action.button_account.clicked.connect(self.signal_account)
card_choose_action.button_coffee.clicked.connect(self.signal_coffee)
card_account.button_back.clicked.connect(self.signal_back)
def set_card_hidden(self, card: QWidget):
card.setGeometry(self.hidden_geometry)
def show_start(self):
self.show_card(GuiCards.Start)
def show_account(self, name, value):
self.cards[GuiCards.AccountInfo].set_user_name(name)
self.cards[GuiCards.AccountInfo].set_balance(value)
self.show_card(GuiCards.AccountInfo)
def show_choose_action(self, name: str):
self.cards[GuiCards.ChooseAction].set_user_name(name)
self.show_card(GuiCards.ChooseAction)
def show_remove(self):
self.show_card(GuiCards.RemoveCard)
def show_card(self, card_id: GuiCards):
if self.active_card is None:
self.active_card = self.cards[GuiCards.Start]
if self.active_card == self.cards[card_id]:
return
if self.visible_geometry is None or self.hidden_geometry is None:
self.visible_geometry = self.active_card.geometry() # type: QRect
self.hidden_geometry = QRect(self.visible_geometry.x(), self.visible_geometry.height() * 1.5,
self.visible_geometry.width(), self.visible_geometry.height())
for key in self.cards.keys():
if key != self.active_card:
self.set_card_hidden(self.cards[key])
card_to_show = self.cards[card_id]
self.start_card_switch(card_to_show)
self.active_card = self.cards[card_id]
self.layout().setCurrentWidget(self.active_card)
def start_card_switch(self, card_to_show):
self.slide_out_animation = QPropertyAnimation(self.active_card, "geometry")
self.slide_out_animation.setDuration(ANIMATION_DURATION)
self.slide_out_animation.setEasingCurve(QEasingCurve.OutCubic)
self.slide_out_animation.setStartValue(self.visible_geometry)
self.slide_out_animation.setEndValue(self.hidden_geometry)
self.set_card_hidden(card_to_show)
#.........这里部分代码省略.........
示例7: ScreensharingToolbox
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
class ScreensharingToolbox(base_class, ui_class):
exposedPixels = 3
def __init__(self, parent):
super(ScreensharingToolbox, self).__init__(parent)
with Resources.directory:
self.setupUi()
parent.installEventFilter(self)
self.animation = QPropertyAnimation(self, 'pos')
self.animation.setDuration(250)
self.animation.setDirection(QPropertyAnimation.Forward)
self.animation.setEasingCurve(QEasingCurve.Linear) # or OutCirc with 300ms
self.retract_timer = QTimer(self)
self.retract_timer.setInterval(3000)
self.retract_timer.setSingleShot(True)
self.retract_timer.timeout.connect(self.retract)
self.resize(self.size().expandedTo(self.toolbox_layout.minimumSize()))
def setupUi(self):
super(ScreensharingToolbox, self).setupUi(self)
# fix the SVG icons, as the generated code loads them as pixmaps, losing their ability to scale -Dan
scale_icon = QIcon()
scale_icon.addFile(Resources.get('icons/scale.svg'), mode=QIcon.Normal, state=QIcon.Off)
viewonly_icon = QIcon()
viewonly_icon.addFile(Resources.get('icons/viewonly.svg'), mode=QIcon.Normal, state=QIcon.Off)
screenshot_icon = QIcon()
screenshot_icon.addFile(Resources.get('icons/screenshot.svg'), mode=QIcon.Normal, state=QIcon.Off)
fullscreen_icon = QIcon()
fullscreen_icon.addFile(Resources.get('icons/fullscreen.svg'), mode=QIcon.Normal, state=QIcon.Off)
fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Normal, state=QIcon.On)
fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Active, state=QIcon.On)
fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Disabled, state=QIcon.On)
fullscreen_icon.addFile(Resources.get('icons/fullscreen-exit.svg'), mode=QIcon.Selected, state=QIcon.On)
minimize_icon = QIcon()
minimize_icon.addFile(Resources.get('icons/minimize.svg'), mode=QIcon.Normal, state=QIcon.Off)
minimize_icon.addFile(Resources.get('icons/minimize-active.svg'), mode=QIcon.Active, state=QIcon.Off)
close_icon = QIcon()
close_icon.addFile(Resources.get('icons/close.svg'), mode=QIcon.Normal, state=QIcon.Off)
close_icon.addFile(Resources.get('icons/close-active.svg'), mode=QIcon.Active, state=QIcon.Off)
self.scale_action.setIcon(scale_icon)
self.viewonly_action.setIcon(viewonly_icon)
self.screenshot_action.setIcon(screenshot_icon)
self.fullscreen_action.setIcon(fullscreen_icon)
self.minimize_action.setIcon(minimize_icon)
self.close_action.setIcon(close_icon)
self.scale_button.setIcon(scale_icon)
self.viewonly_button.setIcon(viewonly_icon)
self.screenshot_button.setIcon(screenshot_icon)
self.fullscreen_button.setIcon(fullscreen_icon)
self.minimize_button.setIcon(minimize_icon)
self.close_button.setIcon(close_icon)
self.scale_button.setDefaultAction(self.scale_action)
self.viewonly_button.setDefaultAction(self.viewonly_action)
self.screenshot_button.setDefaultAction(self.screenshot_action)
self.fullscreen_button.setDefaultAction(self.fullscreen_action)
self.minimize_button.setDefaultAction(self.minimize_action)
self.close_button.setDefaultAction(self.close_action)
self.color_depth_button.clear()
self.color_depth_button.addItem('Default Color Depth', ServerDefault)
self.color_depth_button.addItem('TrueColor (24 bits)', TrueColor)
self.color_depth_button.addItem('HighColor (16 bits)', HighColor)
self.color_depth_button.addItem('LowColor (8 bits)', LowColor)
def eventFilter(self, watched, event):
if watched is self.parent() and event.type() == QEvent.Resize:
new_x = (watched.width() - self.width()) / 2
self.move(new_x, self.y())
self.animation.setStartValue(QPoint(new_x, -self.height() + self.exposedPixels))
self.animation.setEndValue(QPoint(new_x, 0))
return False
def enterEvent(self, event):
super(ScreensharingToolbox, self).enterEvent(event)
self.retract_timer.stop()
self.expose()
def leaveEvent(self, event):
super(ScreensharingToolbox, self).leaveEvent(event)
self.retract_timer.start()
def paintEvent(self, event): # make the widget style aware
option = QStyleOption()
option.initFrom(self)
painter = QStylePainter(self)
painter.drawPrimitive(QStyle.PE_Widget, option)
def expose(self):
if self.animation.state() == QPropertyAnimation.Running and self.animation.direction() == QPropertyAnimation.Forward:
return
elif self.animation.state() == QPropertyAnimation.Stopped and self.pos() == self.animation.endValue():
return
self.animation.setDirection(QPropertyAnimation.Forward)
self.animation.start()
def retract(self):
#.........这里部分代码省略.........
示例8: QStateMachine
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
view.setBackgroundBrush(QBrush(bgPix))
view.setCacheMode(QGraphicsView.CacheBackground)
view.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
view.show()
states = QStateMachine()
states.addState(rootState)
states.setInitialState(rootState)
rootState.setInitialState(centeredState)
group = QParallelAnimationGroup()
for i, item in enumerate(items):
anim = QPropertyAnimation(item, b'pos')
anim.setDuration(750 + i * 25)
anim.setEasingCurve(QEasingCurve.InOutBack)
group.addAnimation(anim)
trans = rootState.addTransition(ellipseButton.pressed, ellipseState)
trans.addAnimation(group)
trans = rootState.addTransition(figure8Button.pressed, figure8State)
trans.addAnimation(group)
trans = rootState.addTransition(randomButton.pressed, randomState)
trans.addAnimation(group)
trans = rootState.addTransition(tiledButton.pressed, tiledState)
trans.addAnimation(group)
trans = rootState.addTransition(centeredButton.pressed, centeredState)
示例9: QPropertyAnimation
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve
animation = QPropertyAnimation()
animation.setTargetObject()
animation.setStartValue(0)
animation.setEndValue(1000)
animation.setDuration(1000)
animation.setEasingCurve(QEasingCurve.InOutQuad)
animation.start()
示例10: QRect
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setEasingCurve [as 别名]
QRect(150, 150, 50, 50), group)
state6 = createGeometryState(button1, QRect(50, 50, 50, 50), button2,
QRect(200, 50, 50, 50), button3, QRect(50, 200, 50, 50), button4,
QRect(200, 200, 50, 50), group)
state7 = createGeometryState(button1, QRect(0, 0, 50, 50), button2,
QRect(250, 0, 50, 50), button3, QRect(0, 250, 50, 50), button4,
QRect(250, 250, 50, 50), group)
group.setInitialState(state1)
animationGroup = QParallelAnimationGroup()
anim = QPropertyAnimation(button4, 'geometry')
anim.setDuration(1000)
anim.setEasingCurve(QEasingCurve.OutElastic)
animationGroup.addAnimation(anim)
subGroup = QSequentialAnimationGroup(animationGroup)
subGroup.addPause(100)
anim = QPropertyAnimation(button3, 'geometry')
anim.setDuration(1000)
anim.setEasingCurve(QEasingCurve.OutElastic)
subGroup.addAnimation(anim)
subGroup = QSequentialAnimationGroup(animationGroup)
subGroup.addPause(150)
anim = QPropertyAnimation(button2, 'geometry')
anim.setDuration(1000)
anim.setEasingCurve(QEasingCurve.OutElastic)
subGroup.addAnimation(anim)