Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
PImage[] imageList = null;    // create an empty array
 
void setup()
{
  size(600,600);      // def. window size
 
  imageList = new PImage[3];
  imageList[0] = loadImage("./images/1.jpg");
  imageList[1] = loadImage("./images/2.jpg");
  imageList[2] = loadImage("./images/3.jpg");
}
 
void draw()
{
  background(255);
 
  pushMatrix();
    translate(10,100);
    for(int i=0;i < imageList.length; i++)
    {
       image(imageList[i],0,0,140,140);
       translate(150,0);
    }
  popMatrix();
}

Download source

Exercise 9

Draw a 4th planet (4.jpg) and let this planet follow the mouse. Change the program (and the image file) so that the planet is shown without the white box surrounding it. What file types are best suited for this? 

...