Powered By Blogger

Saturday 12 March 2011

Experiments with code for my Wall Paper concept.

The following code is one I found on OpenProcessing. It took my interest because of the horizon point angled across the middle, which linked into my theme of arrangement of space.


PImage img;
 
void setup(){
  size(400,400,P3D);
  img = loadImage("art.jpg");
  
  background(0);
  
   
}
float cameraX,cameraY;
 
  void draw (){
    
     
    camera(-100, 50, random(-300,500), widthheight, 1, 1, 1, 1);
    cameraX = radians(map(mouseX, 0, width, 50, 0));
     cameraY = radians(map(mouseY, 0, height, 180, 0));
      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);
  fill(myColor,100);
 rect(x,y,random(20,200),50);
  }

Which looked like this...


I made some changes to the code to remove the black lines around the shapes. Also changing the rectangle to an ellipse. and importing different images from the net to get the colour transition I wanted.

PImage img;
 
void setup(){
  size(375,750,P3D);
  img = loadImage("IMAGE>FROM>NET");
  
  background(0);
  
   
}
float cameraX,cameraY;
 
  void draw (){
    
     
    camera(-100, 50, random(-500,800), width, height, 1, 1, 1, 1);
    cameraX = radians(map(mouseX, 0, width, 50, 0));
     cameraY = radians(map(mouseY, 0, height, 180, 0));
      println(cos(cameraX));
    
    int x=floor(random(0,img.width));
    int y= floor(random(0,img.height));
    
    color myColor = img.get(x,y);
    
  noStroke();
  fill(myColor,50);
 ellipse(x,y,random(10,500),80);

The following were some of the results..



The following was a black and white image. As I am still tossing up between using colour or not. My concept does not call for colour and could work better without any.




No comments:

Post a Comment