Advertisement

# красота

Dec 1st, 2021
2,579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. import math
2. import random
3. import pygame
4. import sys
5.
6. red = (255, 0, 0)
7. white = (255, 255, 255)
8. green = (0, 128, 0)
9. black = (0, 0, 0)
10. cherry = (145, 30, 66)
11. fon = (78, 74, 59)
12.
13. def pixel(surface, color, pos):
14.     surface.fill(color, (pos, (1, 1)))
15. def cosMY(surface, color, pos, half_length):
16.     for xx in range(half_length*10):
17.         x = xx * 0.1
18.         #pixel(surface, color, (x + pos[0], math.cos(x)+ pos[1]))
19.         pixel(surface, color, (pos[0] + x*100, pos[1]  + math.cos(x)*100))
20.         pygame.draw.aaline(screen, black, (pos[0] + x*100, pos[1]  + math.cos(x)*50), (pos[0] + (x+1)*50, pos[1]  + math.cos(x+1)*50))
21. pygame.init()
22. screen = pygame.display.set_mode((1080, 720))
23. clock = pygame.time.Clock()
24. while True:
25.     screen.fill(white)
26.     pygame.draw.line(screen, red, (0, 720/2), (1080, 720/2),  1)
27.     pygame.draw.line(screen, red, (1080/2, 0), (1080/2,720),  1)
28.     pixel(screen, black, (1080/2,720/2))
29.     cosMY(screen, black, (1080/(15/2),720/2), 15)
30.     for event in pygame.event.get():
31.         if event.type == pygame.QUIT:
32.             pygame.quit()
33.             sys.exit()
34.
35.     pygame.display.flip()
36.     clock.tick(60)
37.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement