trainlog-egu5j / ui /animations.py
kuubson's picture
🐳 09/03 - 18:26 - Stwórz kompletną aplikację do odtwarzania playlist M3U / M3U8 napisaną w Pythonie, z nowoczesnym, przejrzystym i premium UI, wizualnie inspirowanym stylem IBO Pro Player. Aplikacja
b9460ef verified
from PySide6.QtCore import QPropertyAnimation, QEasingCurve, QParallelAnimationGroup, QAbstractAnimation
from PySide6.QtWidgets import QWidget
from typing import Optional
class AnimationManager:
@staticmethod
def fade_in(widget: QWidget, duration: int = 300):
animation = QPropertyAnimation(widget, b"windowOpacity")
animation.setDuration(duration)
animation.setStartValue(0)
animation.setEndValue(1)
animation.setEasingCurve(QEasingCurve.OutCubic)
animation.start()
return animation
@staticmethod
def slide_up(widget: QWidget, distance: int = 50, duration: int = 400):
animation = QPropertyAnimation(widget, b"pos")
animation.setDuration(duration)
start_pos = widget.pos()
animation.setStartValue(start_pos + QPoint(0, distance))
animation.setEndValue(start_pos)
animation.setEasingCurve(QEasingCurve.OutExpo)
animation.start()
return animation
@staticmethod
def pulse_widget(widget: QWidget, duration: int = 200):
anim = QPropertyAnimation(widget, b"geometry")
anim.setDuration(duration)
geom = widget.geometry()
center = geom.center()
anim.setStartValue(geom)
anim.setEndValue(geom.adjusted(-2, -2, 2, 2))
anim.setEasingCurve(QEasingCurve.InOutQuad)
anim.start()
return anim
from PySide6.QtCore import QPoint