I was messing around with pygame and tried to make a line spin around its starting point, the problem is that for some reason I have to use negative degrees to make them work in an expected way, otherwise it seems like there's a "delay".
Here's the code:
import pygame
import time
import math
import sys
CLOCK = pygame.time.Clock()
POSITION_WINDOWS_X = 360
POSITION_WINDOWS_Y = 140
WINDOW_SIZE = (400, 400)
SCREEN = pygame.display.set_mode((WINDOW_SIZE))
HALF_SCREEN = [(i)//2 for i in WINDOW_SIZE]
DISPLAY = pygame.Surface(HALF_SCREEN)
ANGLE = math.radians(135)
LENGTH = 50
while True:
DISPLAY.fill((146,244,255))
pygame.draw.line(
DISPLAY,
(255, 0, 0),
[100, 100],
[
100 + LENGTH * math.cos(ANGLE),
100 + LENGTH * math.sin(ANGLE)
],
5
)
ANGLE -= math.radians(1)
ANGLE %= -math.pi*2
print(round(math.degrees(ANGLE)), 'degrees')
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
SCREEN.blit(pygame.transform.scale(DISPLAY, WINDOW_SIZE), (0, 0))
pygame.display.update()
CLOCK.tick(60)




