-
Notifications
You must be signed in to change notification settings - Fork 4
/
circle.py
62 lines (48 loc) · 1.34 KB
/
circle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import pygame as pg
import math
import time
def text_objects(text, font):
textSurface = font.render(text, True, font_color)
return textSurface, textSurface.get_rect()
# Colors
font_color = (255,200,76)
ball_color = (129,102,205)
white = (245,245,245)
w = 1920
h = 1080
radius = 20
width = 0
originX = 1000
originY = 500
flag=0
def circle(time_to_run, quitf=True):
local_time = time.time()
pg.init()
t = 0
screen = pg.display.set_mode((w,h),pg.FULLSCREEN)
running = True
while running:
if (time.time()-local_time)>= time_to_run:
running = False
# for event in pg.event.get():
# if event.type == pg.KEYDOWN:
# running = False
x = int(round(originX + math.cos(t)*800))
y = int(round(originY + math.sin(t)*450))
t+=0.01
t %= (360)
position = (x, y)
screen.fill(white)
largeText = pg.font.Font('Raleway-Medium.ttf',60)
pg.draw.circle(screen,ball_color, position, radius, width)
TextSurf, TextRect = text_objects("Follow the Dot", largeText)
TextRect.center = ((950),(500))
screen.blit(TextSurf, TextRect)
pg.display.flip()
milliseconds = 10
pg.time.delay(milliseconds)
if quitf:
pg.display.quit()
pg.quit()
if __name__ == '__main__':
circle()