本文整理汇总了Python中PyQt5.QtCore.QPropertyAnimation类的典型用法代码示例。如果您正苦于以下问题:Python QPropertyAnimation类的具体用法?Python QPropertyAnimation怎么用?Python QPropertyAnimation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QPropertyAnimation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupAnimes
def setupAnimes(self):
self.shiftAnime1 = QPropertyAnimation()
self.shiftAnime1.setTargetObject(self.ui.widget1)
self.shiftAnime1.setPropertyName("geometry".encode())
self.shiftAnime1.setDuration(400)
self.shiftAnime1.setStartValue(QRect(177, 29, 0, 571))
self.shiftAnime1.setEndValue(QRect(177, 29, 623, 571))
self.shiftAnime2 = QPropertyAnimation()
self.shiftAnime2.setTargetObject(self.ui.widget2)
self.shiftAnime2.setPropertyName("geometry".encode())
self.shiftAnime2.setDuration(400)
self.shiftAnime2.setStartValue(QRect(800, 29, 0, 571))
self.shiftAnime2.setEndValue(QRect(177, 29, 623, 571))
self.shiftAnime3 = QPropertyAnimation()
self.shiftAnime3.setTargetObject(self.ui.widget3)
self.shiftAnime3.setPropertyName("geometry".encode())
self.shiftAnime3.setDuration(400)
self.shiftAnime3.setStartValue(QRect(800, 29, 623, 571))
self.shiftAnime3.setEndValue(QRect(177, 29, 623, 571))
self.shiftAnime4 = QPropertyAnimation()
self.shiftAnime4.setTargetObject(self.ui.widget4)
self.shiftAnime4.setPropertyName("geometry".encode())
self.shiftAnime4.setDuration(400)
self.shiftAnime4.setStartValue(QRect(800, 29, 623, 571))
self.shiftAnime4.setEndValue(QRect(177, 29, 623, 571))
self.selectedWidget = self.ui.widget1
示例2: MoveSymbol
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
示例3: event
def event(self, event):
if event.type() == QEvent.Enter:
self.anim = QPropertyAnimation(self, b"fader")
self.anim.setDuration(150)
self.anim.setEndValue(1.0)
self.anim.start(QPropertyAnimation.DeleteWhenStopped)
elif event.type() == QEvent.Leave:
self.anim = QPropertyAnimation(self, b"fader")
self.anim.setDuration(124)
self.anim.setEndValue(0.0)
self.anim.start(QPropertyAnimation.DeleteWhenStopped)
else:
return QToolButton.event(self, event)
return False
示例4: start_card_switch
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)
self.slide_in_animation = QPropertyAnimation(card_to_show, "geometry")
self.slide_in_animation.setDuration(ANIMATION_DURATION)
self.slide_in_animation.setEasingCurve(QEasingCurve.InCubic)
self.slide_in_animation.setStartValue(self.hidden_geometry)
self.slide_in_animation.setEndValue(self.visible_geometry)
self.animation_group = QParallelAnimationGroup()
self.animation_group.addAnimation(self.slide_out_animation)
self.animation_group.addAnimation(self.slide_in_animation)
self.animation_group.start()
示例5: __init__
def __init__(self):
super().__init__()
self.layout = QVBoxLayout(self)
self.sub_widget = _NotifySubWidget(self)
self.layout.addWidget(self.sub_widget)
self.layout.setContentsMargins(0, 0, 0, 0)
self._exit_shortcut = QShortcut(QKeySequence(Qt.Key_Escape), self)
self._exit_shortcut.activated.connect(self.close)
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.Tool)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setAttribute(Qt.WA_MacAlwaysShowToolWindow)
self.resize(width, height)
self.move(QApplication.desktop().width() - self.width() - 20, 40)
self.setLayout(self.layout)
self._animation = QPropertyAnimation(self, b'windowOpacity')
self._animation.setStartValue(0.8)
self._animation.setKeyValueAt(0.4, 1)
self._animation.setEndValue(0)
self._animation.setDuration(5000)
self._animation.finished.connect(self.close)
示例6: switch
def switch(self, anim=True):
var = False
for neighbor in self.getNeighbors():
if neighbor.isEmpty:
Xself = self.pos().x()
Yself = self.pos().y()
Xneigh = neighbor.pos().x()
Yneigh = neighbor.pos().y()
if self.perfectPos.x() == Xneigh and \
self.perfectPos.y() == Yneigh:
self.hasPerfectPos = True
else:
self.hasPerfectPos = False
if neighbor.perfectPos.x() == Xself and \
neighbor.perfectPos.y() == Yself:
neighbor.hasPerfectPos = True
else:
neighbor.hasPerfectPos = False
if anim:
self.animation = QPropertyAnimation(self, "geometry")
self.animation.setDuration(200)
self.animation.setEndValue(QRect(Xneigh,
Yneigh,
self.width(),
self.height()))
self.animation.start()
else:
self.move(Xneigh, Yneigh)
neighbor.move(Xself, Yself)
var = True
return var
示例7: show_anim
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()
示例8: hide_anim
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()
示例9: fadeIn
def fadeIn(self):
self.anim = QPropertyAnimation(self.opacity_effect, 'opacity')
self.anim.setDuration(800)
self.anim.setStartValue(0)
self.anim.setEndValue(1)
self.anim.start()
self.timer.stop()
示例10: createPositionAnimation
def createPositionAnimation(self, item, duration):
ani = QPropertyAnimation(item, b'pos', self)
ani.setDuration(duration)
ani.setStartValue(item.pos())
width = self.squareWidth * 7
ani.setEndValue(QPointF(width - item.x(),
width - item.y()))
return ani
示例11: __init__
def __init__(self, parent):
QObject.__init__(self, parent)
self._toolbar = parent
self.icon = None
self.text = ""
self.has_menu = False
self.enabled = True
self._fader = 0
self._animator = QPropertyAnimation(self)
self._animator.setPropertyName(b"fader")
self._animator.setTargetObject(self)
示例12: __init__
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)
示例13: animate
def animate(self, item, property_name, duration, start_value, end_value):
"""Summary
Args:
item (TYPE): Description
property_name (TYPE): Description
duration (TYPE): Description
start_value (TYPE): Description
end_value (TYPE): Description
"""
if item is not None:
b_name = property_name.encode('ascii')
anim = QPropertyAnimation(item.adapter, b_name)
anim.setDuration(duration)
anim.setStartValue(start_value)
anim.setEndValue(end_value)
anim.start()
item.adapter.saveRef(property_name, anim)
示例14: __init__
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()))
示例15: animate
def animate(self, item: QGraphicsItem,
property_name: str, duration: int,
start_value, end_value):
"""
Args:
item: Description
property_name: Description
duration: Description
start_value (QVariant): Description
end_value (QVariant): Description
"""
b_name = property_name.encode('ascii')
anim = item.adapter.getRef(property_name)
if anim is None:
anim = QPropertyAnimation(item.adapter, b_name)
item.adapter.saveRef(property_name, anim)
anim.setDuration(duration)
anim.setStartValue(start_value)
anim.setEndValue(end_value)
anim.start()