added a fade_in effect to the knobs

This commit is contained in:
SallarShayegan
2025-03-02 20:16:40 +01:00
parent 27ea7f2504
commit 6f0e1e3e5e
3 changed files with 27 additions and 9 deletions

View File

@ -12,7 +12,7 @@ class Knob:
self.position = position
self.value = value
self.focused = False
self.fade_count_down = 300
self.fade_count_down = 150
self.vanish_label_path = False
self.label_path = []
@ -45,7 +45,7 @@ class Knob:
y = (self.radius - 5) * math.sin(angle) + self.position[1]
return(x, y)
def display(self, screen):
def display(self, surface):
m1, m2, m3 = pygame.mouse.get_pressed(3)
if m1:
pos = pygame.mouse.get_pos()
@ -56,6 +56,6 @@ class Knob:
if self.fade_count_down == 0:
self.vanish_label_path = True
self.set_focused(False)
pygame.draw.circle(screen, self.color, self.position, self.radius)
pygame.draw.line(screen, "black", self.position, self.get_pointer_position(), 4)
pygame.draw.circle(surface, self.color + (self.group.opacity,), self.position, self.radius)
pygame.draw.line(surface, "black", self.position, self.get_pointer_position(), 4)