Powered By Blogger

Monday 21 March 2011

Final Wallpaper One

With this wallpaper I explored the ellipse shape and imported the image of a rose below in order to get a nice distribution of red and black across the image.

What is important to note is that the code is only reading part of the image, because of the 1 by 2 size I have set my code to animate in.








Here is the Final Code in dark blue. My notes are in red.


import processing.pdf.*; // Saving as PDF command




PImage img;
float cameraX,cameraY;

void setup(){
  size(500,1000,P2D); //Here is the size of the canvas, and the dimension of the sketch: 2D
  img = loadImage("http://images.psxextreme.com/wallpapers/ps3/red_rose_01.jpg"); //This is where the URL of the Image I have decided to use is imported. 


  beginRecord(PDF, "wallpaper_1.pdf"); // Saving as PDF command
  background(0);
   
}


void draw (){


  camera(-100, 50, random(-500,800), width, height, 1, 1, 1, 1); //Camera had a lot more of an effect in the P3D images.

  println(cos(cameraX));
    
  int x=floor(random(0,img.width));
  int y= floor(random(0,img.height));
    
  color myColor = img.get(x,y); //Gets the colour form the image imported.
    
  stroke(0,5); //Here I have decided to use a stroke around the object, to ever so slightly define the shape being used.
  fill(myColor,random(1,20)); //The random colour sample from imported image.
  ellipse(x,y,random(0,400),random(0,40)); //The ellipses being drawn from the image width and height and at random across the canvas dimensions.
  smooth();


}
  
void keyPressed(){
  endRecord();// Saving as PDF command
}


Below is the final Image from this code (after a certain amount of animation and stopped when the image had built up to the standard I was happy with)...

No comments:

Post a Comment