當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.QPropertyAnimation類代碼示例

本文整理匯總了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
開發者ID:blackskygg,項目名稱:jielu,代碼行數:30,代碼來源:blueApp.py

示例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
開發者ID:examon,項目名稱:opengeode,代碼行數:33,代碼來源:undoCommands.py

示例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
開發者ID:ninja-ide,項目名稱:ninja-ide,代碼行數:14,代碼來源:ui_tools.py

示例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()
開發者ID:CCTB-UW,項目名稱:kaffeekasse,代碼行數:16,代碼來源:qtguicontroller.py

示例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)
開發者ID:ykelvis,項目名稱:FeelUOwn,代碼行數:26,代碼來源:notify.py

示例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
開發者ID:Longhanks,項目名稱:Tiles,代碼行數:31,代碼來源:tile.py

示例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()
開發者ID:gcr,項目名稱:pocketwatch,代碼行數:7,代碼來源:PomodoroClockView.py

示例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()
開發者ID:gcr,項目名稱:pocketwatch,代碼行數:7,代碼來源:PomodoroClockView.py

示例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()
開發者ID:devos50,項目名稱:TriblerGUI,代碼行數:7,代碼來源:channel_list_item.py

示例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
開發者ID:thesmartwon,項目名稱:OpenChess-Python,代碼行數:8,代碼來源:board.py

示例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)
開發者ID:ninja-ide,項目名稱:ninja-ide,代碼行數:11,代碼來源:ui_tools.py

示例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)
開發者ID:examon,項目名稱:opengeode,代碼行數:12,代碼來源:undoCommands.py

示例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)
開發者ID:cadnano,項目名稱:cadnano2.5,代碼行數:18,代碼來源:gridextras.py

示例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()))
開發者ID:AGProjects,項目名稱:blink-qt,代碼行數:14,代碼來源:vncviewer.py

示例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()
開發者ID:cadnano,項目名稱:cadnano2.5,代碼行數:20,代碼來源:pathextras.py


注:本文中的PyQt5.QtCore.QPropertyAnimation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。