added test animation

This commit is contained in:
Nicholas Dyer 2023-02-19 17:45:34 -05:00
parent f65bb04f5b
commit 8ee2660fb9
No known key found for this signature in database
GPG Key ID: E4E6388793FA2105

View File

@ -15,8 +15,20 @@ class Dial(pygame.sprite.Sprite):
self.max = (10.0 / 6.0) * PI self.max = (10.0 / 6.0) * PI
self.min = (8.0 / 6.0) * PI self.min = (8.0 / 6.0) * PI
self.value = 1 self.value = 1
self.reverse = True
def update(self): def update(self):
if self.reverse:
self.value -= 0.01
else:
self.value += 0.01
if self.value < 0:
self.value = 0
self.reverse = not self.reverse
if self.value > 1:
self.value = 1
self.reverse = not self.reverse
self.image.fill((0, 0, 0)) self.image.fill((0, 0, 0))
pygame.draw.arc(self.image, (255, 255, 255), self.rect, self.min - (self.max * self.value), self.min, 32) pygame.draw.arc(self.image, (255, 255, 255), self.rect, self.min - (self.max * self.value), self.min, 32)