Tweak a little bit more, one more circle draw function.... so much more interesting outcome... LOVE IT!
Smoother version (in video format) PLEASE WATCH IN 720
CODE :
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import math ##import math library
cx = 400.
cy = 400.
rad = 300.
##define 'colors' list
colors = range(5)
colors[0] = color(10,58,74,150)
colors[1] = color(25,106,115,150)
colors[2] = color(50,166,166,150)
colors[3] = color(161, 191, 51,150)
colors[4] = color(200, 217, 74, 150)
def setup(): ##setup the sketch
size(800, 800)
stroke(255) ##white stroke
smooth() ##smoother graphic
frameRate(100)
def draw(): ##draw on the sketch
background(240) ##almost white colour, refresh sketch
time = millis()/9000. ##change through time
x = (float)(cx+rad*math.cos(time)) ##position X
y = (float)(cy+rad*math.sin(time)) ##positin Y
##color changer | change through positionY
if (y<=200.):
rc = colors[0]
if (y>200.) and (y<=400.):
rc = colors[2]
if (y>400.) and (y<=600.):
rc = colors[3]
if (y>600.) and (y<=800.):
rc = colors[4]
fill(rc)
for i in range(1, 800): ##loop i = 1->799
angle = y + i/2.01 ##angle based on position Y
##increase i for distance between spirals
transX = i * 1.618 * math.pow(math.sin(angle),1) ##Xtranslation
transY = i * 1.618 * math.pow(math.cos(angle),1) ##Ytranslation
width = math.pow(i, -1) ##can use sin or cos(whatever)
ellipse(x+transX, y+transY, width+i*0.39, width+i*0.39) ##width+i*... = amplify number(big or small)
ellipse(x-transX, y-transY, width+i*0.2, width+i*0.2)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
No comments:
Post a Comment