Powered By Blogger

Monday 21 March 2011

Final Wallpaper Four

This Wallpaper explores triangles drawn at random in a certain area within the canvas (1x2). Again using an image to determine the colour used to fill the shape and where the colours are situated on the wallpaper. Below is the image I used for the wallpaper.













Below is my final code:



import processing.pdf.*;




PImage img;
float cameraX,cameraY;

void setup(){
  size(500,1000,P2D);
  img = loadImage("http://fc01.deviantart.net/fs42/f/2009/165/5/f/Purple_Pink_Sunset_by_boaz_rbg.jpg");


  beginRecord(PDF, "wallpaper_4.pdf"); 
  background(0);
   
}


void draw (){


  camera(-100, 50, random(-500,800), width, height, 1, 1, 1, 1);

  println(cos(cameraX));
    
  int x=floor(random(0,img.width));
  int y= floor(random(0,img.height));
    
  color myColor = img.get(x,y);
    
  stroke(0,5); //Decided to include a thin outline to the triangles to define them and reference the shape used.
  fill(myColor,10); //Transparency is 10 in order to build up the picture over time and blend the triangles, creating a soft look.
  triangle(x,y,x,random(50,950),random(-200,0),random(50,950)); //Triangles have been told to be drawn within the middle section of the sketch.


}
  
void keyPressed(){
  endRecord();
}

Final Wallpaper:

No comments:

Post a Comment