Monday, 30 April 2012

Fixing up code

This image below is pretty similar to the previous experiments, however i've now changed the code so that it is much more user friendly for me to customize. Originally, each of the forms was written as an ellipse code, within a function. Like this:

       
        ellipse(x*data[i-1]+500,y*data[i]+(100+data[i]),size,size)
        ellipse(x*data[i-1]+(600+data[i]),y*data[i]+(200+data[i]),size,size)
        fill(random(150,180),0,0,10)
        ellipse(x*data[i-1]+(900+data[i]),-y*data[i]+(200+data[i]),size,size)
        fill(random(50,100),0,0,10)
        ellipse(-x*data[i-1]+(900+data[i]),-y*data[i]+(500+data[i]),size,size)
     
But many many more ellipses.

So with this new version, i've changed it so the different parts of the ellipse are variables, which i can alter in the draw function (rather than changing them within the function itself). I'm not sure of the correct way to describe that but i think you will understand.
So now its more like...

def plot (data, yoff,minusx,minusy,xpos,ypos,size,col1,col2):
      extra stuff here

      ellipse((minusx*x)*data[i-1]+(xpos+data[i]),(minusy*y)*data[i]+(ypos+data[i]),size,size)


I plan to extend the number of variables later to include the colour, size, pow numbers etc so that i have full control over each individual form, or part, of the image. 














No comments:

Post a Comment