Advertisement
farry

Untitled

Jan 11th, 2024
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | Software | 0 0
  1. import tkinter as tk
  2. import time, cmath
  3.  
  4. size, frames = 600, 100
  5. root = tk.Tk()
  6. canv = tk.Canvas(root, width=size, height=size, bg="bisque")
  7. canv.pack()
  8.  
  9. blade = [4-2j, 12-3j, 22-1j, 22+1j, 12+3j, 4+2j]
  10. bladephases = [cmath.exp(x * cmath.pi * 2j/5) for x in range(5)]
  11. propellor = [p * b/45 for p in bladephases for b in blade ]
  12.                
  13. while True:
  14.     for angle in [x * 2/5 * cmath.pi / frames for x in range(frames)]:
  15.         spinprop = [p * cmath.exp(angle * 1j) for p in propellor]
  16.         plotline = [p for s in spinprop for p in [s.real, s.imag]]
  17.         sizedline = [ (p + 0.5) * size for p in plotline]
  18.         line = canv.create_polygon(*sizedline, fill="black")
  19.         root.update()
  20.         time.sleep(0.04)
  21.         canv.delete(line)
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement