I've had the Processing book for about a week now. It arrived in the bookshop sooner than expected. I've been playing with 2D arrays and some basic code is shown below. This just draws a "gradient" type of effect as output:
/*
My First Experiment with 2D Arrays
Mark Moran
19-11-08
*/
float[][] myArray;
myArray = new float[200][200];
size(200, 200);
background(0);
for(int i=0; i<200; i++) {
for(int j=0; j<200; j++) {
myArray[i][j] = i;
}
}
for(int i=0; i<200; i++) {
for(int j=0; j<200; j++) {
stroke(myArray[i][j]);
point(i, j);
}
}
The stuff in the book about loading an image from a file and manipulating it appeals to me in particular. I feel a jigsaw type of application coming on! This would probably be more suitable for the main program, i.e. not the one which is given as a primary example to the student. For the latter, something more simple should suffice...
Tuesday, December 9, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment