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 __init__(self, closeWidget, messageString='', opacity=0.60, parent=None): super(AnimatedClosableMessage, self).__init__(closeWidget, messageString, opacity, parent=parent) self._show_hide_anim = QPropertyAnimation(self, "maximumHeight") self._show_hide_anim.setDuration(200) self._show_hide_anim.setEasingCurve(QEasingCurve.InSine)
def __init__(self, parent=None): super(ProgressLineEdit, self).__init__(parent) self._progress = 0 self.text_changed.connect(self.setText) self.setProperty("_progress_opacity", self.INITIAL_PROGRESS_OPACITY) self._progress_finished_anim = QPropertyAnimation( self, "_progress_opacity") self._progress_finished_anim.setStartValue( self.INITIAL_PROGRESS_OPACITY) self._progress_finished_anim.setEndValue(0) self._progress_finished_anim.setDuration(1000) self._progress_finished_anim.valueChanged.connect(self.repaint)
def animateWidget(self, widget, distance, direction): widget_anim = QPropertyAnimation(widget, "geometry") cur_geom = widget.geometry() next_geom = QRect(cur_geom) if direction == self.LEFT: next_geom.moveTo(widget.pos() - QPoint(distance, 0)) elif direction == self.RIGHT: next_geom.moveTo(widget.pos() + QPoint(distance, 0)) widget_anim.setDuration(self.ANIM_DURATION) widget_anim.setEasingCurve(self.EASING) widget_anim.setStartValue(cur_geom) widget_anim.setEndValue(next_geom) self._anim_grp.addAnimation(widget_anim)
def _setupAnimation(self): self._load_animation = QPropertyAnimation(self._label_movie, "geometry") # since the opacity is failing, make it run out of the area! anim_label_geom = self._label_movie.geometry() self._load_animation.setStartValue(anim_label_geom) target_anim_geom = QRect(anim_label_geom) target_anim_geom.moveTop(self.height()) # make the animation target a rectangle that's directly under it but shifted downwards outside of parent self._load_animation.setEndValue(target_anim_geom) self._load_animation.setEasingCurve(QEasingCurve.InBack) self._load_animation.setDuration(1000) self._load_animation.finished.connect(self.animation_finished) self._load_animation.finished.connect(self._hideAnimLabel)