asquare
YaBB Newbies
Offline
Posts: 36
Re: variable variables
Reply #3 - Nov 14th , 2005, 6:53pm
Got your array solution working, this was actually a parrallel image rotation attempt to the other posting you were responding to here http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1131471481 so that solves both of those for me thanks for your help, below is the code for anyone else who wants to use it. public class rotateimage extends PApplet { //initialise variables int v_width, v_height, v_screenwidth, v_screenheight; float v_increment = 0.00; PImage [] buffer; //setup function void setup() { //set stage size v_screenwidth = screen.width; v_screenheight = screen.height; size(v_screenwidth, v_screenheight, P3D); //set stage background background(0, 0, 0); //width and height stored as a variable v_width = 318; v_height = 256; //create an array with images buffer = new PImage[360]; //load image PImage loadimage = loadImage("confused-black-dog.jpg"); //centre all image placements translate(width / 2, height / 2); //loop through the buffer array for(int i = 0; i < buffer.length; i++) { //put an image in the buffer array buffer[i] = new PImage(v_width, v_height); //copy image in memory into image in buffer array loadPixels(); buffer[i].copy(loadimage, 0, 0, loadimage.width, loadimage.height, 0, 0, v_width, v_height); buffer[i].updatePixels(); //display the image image(buffer[i], 0, 0); //rotate the image rotate(v_increment); //rotate this amount on next loop v_increment = 0.01754; } } }