Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #! /usr/bin/python3
  2.  
  3. import pygame
  4. from time import sleep
  5. from math import sin
  6.  
  7. WIDTH = 1000
  8. HEIGHT = 700
  9.  
  10. def main():
  11. pygame.init()
  12. points = {(i, -10) for i in range(HEIGHT)}
  13. screen = pygame.display.set_mode((WIDTH, HEIGHT))
  14. surface = pygame.Surface((WIDTH, HEIGHT))
  15. phase = 0
  16. while True:
  17. phase += 0.1
  18. points = {(i, v+sin(phase+0.01*phase*i)) for (i, v) in points}
  19. for i, v in points:
  20. screen.set_at((int(v*30+WIDTH/2), i), 16777215)
  21. pygame.display.flip()
  22. sleep(0.01)
  23. screen.fill(0)
  24.  
  25.  
  26. if __name__ == '__main__':
  27. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement