Advertisement
micycle

Pretty Circular Patterns (In processing)

Oct 6th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. #implementation of my Scratch project [ https://scratch.mit.edu/projects/121049579/#player ] in Processing.
  2.  
  3. import timeit
  4. import math
  5. start_time = timeit.default_timer()
  6. theta = 0
  7. timer = 0
  8.  
  9. def setup():
  10.   size(800, 800)
  11.   background(255)
  12.   frameRate(66)
  13.   noStroke()
  14.   fill(0)
  15.  
  16. def draw():
  17.     if mousePressed == False: # Click to disable clearing
  18.         background(255)
  19.     display()
  20.  
  21.  
  22. def display():
  23.    
  24.     global theta
  25.     global timer
  26.     theta = 0
  27.     pattern_id = 249 #_;
  28.     timer = (timeit.default_timer() - start_time)
  29.        
  30.     while theta <= 360:
  31.         temp = math.radians(theta)
  32.         ellipse(cos(temp)*(width/2.25*sin(((timer/300)+(temp/5))*pattern_id)) + width/2,sin(temp)*(height/2.25*sin(((timer/300)+(temp/5))*pattern_id)) + height/2,3,3)
  33.         theta = theta + 3.6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement