@@ -12,25 +12,25 @@ def __init__(self, text='Other API', duration=1000, start_value=1, end_value=0.5
1212 self .setGraphicsEffect (self .opacity_effect )
1313
1414 # Create the animation for the opacity effect
15- self .animation = QPropertyAnimation (self .opacity_effect , b"opacity" )
16- self .animation .setDuration (duration ) # Duration of one animation cycle (in milliseconds)
17- self .animation .setStartValue (start_value ) # Start with full opacity
18- self .animation .setEndValue (end_value ) # End with lower opacity
19- self .animation .setEasingCurve (QEasingCurve .Type .InOutQuad ) # Smooth transition
15+ self .opacity_animation = QPropertyAnimation (self .opacity_effect , b"opacity" )
16+ self .opacity_animation .setDuration (duration ) # Duration of one animation cycle (in milliseconds)
17+ self .opacity_animation .setStartValue (start_value ) # Start with full opacity
18+ self .opacity_animation .setEndValue (end_value ) # End with lower opacity
19+ self .opacity_animation .setEasingCurve (QEasingCurve .Type .InOutQuad ) # Smooth transition
2020
2121 # Set the animation to alternate between fading in and out
22- self .animation .setDirection (QPropertyAnimation .Direction .Forward ) # Start direction
22+ self .opacity_animation .setDirection (QPropertyAnimation .Direction .Forward ) # Start direction
2323
2424 # Connect the animation's finished signal to reverse direction
25- self .animation .finished .connect (self .reverse_animation_direction )
25+ self .opacity_animation .finished .connect (self .reverse_animation_direction )
2626
2727 # Start the animation
28- self .animation .start ()
28+ self .opacity_animation .start ()
2929
3030 def reverse_animation_direction (self ):
3131 # Reverse the direction of the animation each time it finishes
32- if self .animation .direction () == QPropertyAnimation .Direction .Forward :
33- self .animation .setDirection (QPropertyAnimation .Direction .Backward )
32+ if self .opacity_animation .direction () == QPropertyAnimation .Direction .Forward :
33+ self .opacity_animation .setDirection (QPropertyAnimation .Direction .Backward )
3434 else :
35- self .animation .setDirection (QPropertyAnimation .Direction .Forward )
36- self .animation .start ()
35+ self .opacity_animation .setDirection (QPropertyAnimation .Direction .Forward )
36+ self .opacity_animation .start ()
0 commit comments