Hey all.
Just started fiddling about with processing, what an interesting visual program! For my current project I need an engine which can simulate the random 'pointilistic' dots appearing on screen but within a grid (or cell) structure, so rather then a dot appearing at any x or y point in the canvas i need it to simulate a 'pixel to pixel' affect... any ideas?
my attempts have been pretty fruitless, however heres my work so far (mainly taken from going through tutorials and experimenting with different scripts, very inexperienced so any tips would be fantastic, so far have no clue how to implement the random element of the script)
Cheers
Sam
import gifAnimation.*;
Gif loo;
int cellsize = 10;
int cols, rows;
void setup() {
size(353,519, P3D);
frameRate(500);
println("gifAnimation " + Gif.version());
loo= new Gif (this, "sam2.gif");
loo.loop();
cols = width/cellsize;
rows = height/cellsize;
}
void draw() {
background(0);
loadPixels();
for ( int i = 0; i < cols;i++) {
for ( int j = 0; j < rows;j++) {
int x = i*cellsize + cellsize/2; // x position
int y = j*cellsize + cellsize/2; // y position
int loc = x + y*width; // Pixel array location
color c = loo.pixels[loc]; // Grab the color
pushMatrix();
translate(x,y);
fill(c);
noStroke();
rectMode(CENTER);
rect(0,0,cellsize,cellsize);
popMatrix();
}
}
}
Just started fiddling about with processing, what an interesting visual program! For my current project I need an engine which can simulate the random 'pointilistic' dots appearing on screen but within a grid (or cell) structure, so rather then a dot appearing at any x or y point in the canvas i need it to simulate a 'pixel to pixel' affect... any ideas?
my attempts have been pretty fruitless, however heres my work so far (mainly taken from going through tutorials and experimenting with different scripts, very inexperienced so any tips would be fantastic, so far have no clue how to implement the random element of the script)
Cheers
Sam
import gifAnimation.*;
Gif loo;
int cellsize = 10;
int cols, rows;
void setup() {
size(353,519, P3D);
frameRate(500);
println("gifAnimation " + Gif.version());
loo= new Gif (this, "sam2.gif");
loo.loop();
cols = width/cellsize;
rows = height/cellsize;
}
void draw() {
background(0);
loadPixels();
for ( int i = 0; i < cols;i++) {
for ( int j = 0; j < rows;j++) {
int x = i*cellsize + cellsize/2; // x position
int y = j*cellsize + cellsize/2; // y position
int loc = x + y*width; // Pixel array location
color c = loo.pixels[loc]; // Grab the color
pushMatrix();
translate(x,y);
fill(c);
noStroke();
rectMode(CENTER);
rect(0,0,cellsize,cellsize);
popMatrix();
}
}
}
1