So far this is working on Pyside6 and possibly PySide2 as well. Does not work on PyQt6, I will fix the error in the future
This repository contains two classes: BackDrop is a graphical effect in which you need to set a list of backgrounds, blur and a border radius. BackDropWrapper - a handy wrapper for displaying and animation the backdrop effect.
BackDrop(blur: int = 0, radius: int = 0, backgrounds: list[dict] = None)
BackDropWrapper(widget: QtWidgets.QObject , blur: int = 0, radius: int = 0, backgrounds: list[dict] = None, shine_animation: list = None, move_animation: tuple = None)
The backgrounds is set as follows:
grad = QtGui.QLinearGradient(0, 0, 1, 1)
grad.setCoordinateMode(QtGui.QLinearGradient.CoordinateMode.ObjectMode)
grad.setStops([(0, QtGui.QColor(255, 255, 255, 255)), (0.35, QtGui.QColor(255, 255, 255, 125)), (0.65, QtGui.QColor(255, 255, 255, 125)), (1,QtGui.QColor(255, 255, 255, 255))])
backgrounds=[{"background-color": grad, "border": QtGui.QColor("#FFFFFF"),"border-width": 2, "opacity": .4}]
Animations run when you hover over the widget and also run in reverse again when you leave the mouse. All animations are disabled by default, but you can enable them by passing the following arguments:
shine_animation = (duration: int, forward: bool, angle: int, width: int, color: QtGui.QColor)
move_animation = (duration: int, offset: tuple, forward: bool)
or you can create BackDropWrapper element and set:
bdw = BackDropWrapper(QtWidgets.QLabel("Hello World!"), blur=10, radius=25, backgrounds=backgrounds)
bdw.enable_shine_animation(color=QtGui.QColor(255, 255, 255, 90))
bdw.enable_move_animation(offset=(0, -30))