Wednesday 16 May 2012

MORE TRIALS TO GET MORE INTERESTING

From the previous trial with circles, I found it was very interesting to create something like a huge system like the underwater world with bubbles or.... maybe a galaxy. Yeah, should do it.

Comment : Tried with the alpha on black colours to blend out the circles, also applied one more ellipse function to draw the ring around a specific center. The outcome is magnificent, looked so much like a galaxy with a big planet at the center.
CODE :
------------------------------------------------------------------------------------------------------------------
 import math

XRES = 600
YRES = 400
centerX = random(XRES/2,XRES)
centerY = random(YRES/2,YRES)

def setup():
    size(XRES, YRES)
    background(255)
    noStroke()
    fill(0,0,0,80)
    smooth()
  
randata = []
for i in range(XRES):
    randata = randata + [random(-100.,100.)]
  
def plot(data, yoff):
    for i in range(1, XRES):
        angle = random(0.,PI*2)
        x = i*1.618*sin(angle)
        y = i*1.618*cos(angle)
        ellipse(centerX+x,centerY+y,data[i]/4,data[i]/4)
      
def filter(data):
    for i in range(1,XRES-1):
        data[i]=0.5*(data[i-1] + data[i+1])
                          
      
def draw():
    filter(randata)
    if (2*frameCount)<(800):
        plot(randata, 2*frameCount)
------------------------------------------------------------------------------------------------------------------

Now I was trying with more frameCount to get more circles, so I cranked it up into 2000 instead of 800. The number would cause a crash though, but would worth a try as well .

Comment : The outcome is great, but I thought it was a bit too off focus there. The black took lots of spaces, made it look like a black hole rather than a galaxy. Also to point out the tiny circles, I tried to tweak a little bit with the second "ellipse" function to get much smaller stars.

CODE :
------------------------------------------------------------------------------------------------------------------
 import math

XRES = 600
YRES = 400
centerX = random(XRES/2,XRES-200)
centerY = random(YRES/2,YRES-200)

def setup():
    size(XRES, YRES)
    background(255)
    noStroke()
    fill(0,0,0,80)
    smooth()
  
randata = []
for i in range(XRES):
    randata = randata + [random(-150.,150.)]
  
def plot(data, yoff):
    for i in range(1, XRES):
        angle = random(0.,PI*2)
        x = i*1.618*sin(angle)
        y = i*1.618*cos(angle)
        ellipse(centerX+x,centerY+y,data[i]/4,data[i]/4)
        ellipse(centerX+2*x,centerY+2*y,data[i]/4,data[i]/4)
      
def filter(data):
    for i in range(1,XRES-1):
        data[i]=0.5*(data[i-1] + data[i+1])
                          
      
def draw():
    filter(randata)
    if (2*frameCount)<(2000):
        plot(randata, 2*frameCount)
------------------------------------------------------------------------------------------------------------------

I thought I should have gone back a bit with the amount of circles as well as the radius.
Comment : Much smaller black center, the rings out side is clearly shaped. The outcome is awesome, I like it.

CODE :
------------------------------------------------------------------------------------------------------------------
 import math

XRES = 600
YRES = 400
centerX = random(XRES/2,XRES-200)
centerY = random(YRES/2,YRES-200)

def setup():
    size(XRES, YRES)
    background(255)
    noStroke()
    fill(0,0,0,80)
    smooth()
  
randata = []
for i in range(XRES):
    randata = randata + [random(-150.,150.)]
  
def plot(data, yoff):
    for i in range(1, XRES):
        angle = random(0.,PI*2)
        x = i*1.618*sin(angle)
        y = i*1.618*cos(angle)
        ellipse(centerX+x,centerY+y,data[i]/5,data[i]/5)
        ellipse(centerX+2*x,centerY+2*y,data[i]/7,data[i]/7)
      
def filter(data):
    for i in range(1,XRES-1):
        data[i]=0.5*(data[i-1] + data[i+1])
                      
      
def draw():
    filter(randata)
    if (4*frameCount)<(2000):
        plot(randata, 4*frameCount)
------------------------------------------------------------------------------------------------------------------ 

I just found the problem I got here was the center of my galaxy just randomly placed to the right of the sketch. So I tried to figure out the way to make this right. Putting a negative number in the random in the sketch would help. Also I tweaked the size of the sketch to get more stars in a sketch, I thought it would be more interesting though.

Comment : The ring is random as well. However the ring is pleasure to me already.

CODE :
------------------------------------------------------------------------------------------------------------------
 import math

XRES = 900
YRES = 700
centerX = random(XRES/2,XRES-200)
centerY = random(YRES/2,YRES-200)

def setup():
    size(XRES, YRES)
    background(255)
    noStroke()
    fill(0,0,0,80)
    smooth()
  
randata = []
for i in range(XRES):
    randata = randata + [random(-150.,150.)]
  
def plot(data, yoff):
    for i in range(1, XRES):
        angle = random(0.,PI*2)
        x = i*1.618*sin(angle)
        y = i*1.618*cos(angle)
        ellipse(centerX+x,centerY+y,data[i]/5,data[i]/5)
        ellipse(centerX+2*x,centerY+2*y,data[i]/7,data[i]/7)
      
def filter(data):
    for i in range(1,XRES-1):
        data[i]=0.5*(data[i-1] + data[i+1])
                          
      
def draw():
    filter(randata)
    if (4*frameCount)<(2500):
        plot(randata, 4*frameCount)
------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment