Skip to content

Instantly share code, notes, and snippets.

@stevefaeembra
Created August 4, 2015 22:24
Show Gist options
  • Save stevefaeembra/5a466f403894816cadc6 to your computer and use it in GitHub Desktop.
Save stevefaeembra/5a466f403894816cadc6 to your computer and use it in GitHub Desktop.
Polar processing sketch (in Python)
import math
import random
def setup():
size(900,900)
background(0)
ellipseMode(CENTER)
noStroke()
fill(255,255,255,11)
def mousePressed():
saveFrame("/tmp/output.png")
print "Saved frame"
ix = 0 # frame counter
def draw():
global ix
# here are some interesting values to get you started
fac=[.4,2.22,0.00014159265]
fac=[1.07,.002,0.00014159265]
fac=[.001,.02,0.00014159265]
fac=[.04,.04,.502]
#fac=[.001,1/((ix%10)+1),1/((ix%10)+1)]
# change the iteration count to alter the speed of the animation
for i in range(0,10000):
ix += 1
ix2 = ix*.1
fc = float(ix) * .1
a1 = fc*fac[0]
r1 = 100.0+(200.0+sin(ix2))
a2 = fc*fac[1]
r2 = 50.0+(100.0*sin(ix2))
a3 = fc*fac[2]
r3 = 25.0+(50.0*sin(ix2))
x = 450+(r1*sin(a1))+(r2*sin(a2))+(r3*sin(a3))
y = 450+(r1*cos(a1))+(r2*cos(a2))+(r3*cos(a3))
ellipse(x,y,1,1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment