After Tuesdays tutorial I realised that although I understood parts of the code I still didn't know how the camera function worked at all, or how I could change the code to only animate for a certain length of time. After being taught about for() loops and discussing with Luke my options, I soon gathered that I could make the code animate for a certain amount of frames before stopping, by using a for() loop. Exciting!
In addition, after Fridays tutorial I found that I could take a snap shot of the animation and save this as a PDF. However I still plan to use for loops as they allow me to alter the image in ways I hadn't expected.
Thursday, 17 March 2011
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), 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); |
|
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.
Subscribe to:
Posts (Atom)




