Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
stu.hooper
stu.hooper's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Making a Random String Mouseclick
[3 Replies]
22-Nov-2011 03:53 AM
Forum:
Programming Questions
Hello Processing Forum,
I trust you are all well.
I'm trying to make a program that displays a random image from a string with a mouse click. With a starting 'homepage' image that always loads first.
Is this possible or am I a fool?
int maxImages = 16; //total number of images
int imageIndex = 0; // Start with first image (0 not 1)
PImage b; //background
PImage[] images = new PImage [maxImages]; // The Image Array
String[] filenames = {"iBlame1.gif", "iBlame2.gif", "iBlame3.gif",
"iBlame4.gif", "iBlame5.gif", "iBlame6.gif", "iBlame7.gif", "iBlame8.gif",
"iBlame9.gif", "iBlame10.gif", "iBlame11.gif", "iBlame12.gif", "iBlame13.gif",
"iBlame14.gif", "iBlame15.gif", "iBlame16.gif"};
int index = int (random(images.length));;
void setup()
{
size(640,960);
b = loadImage("Homepage.gif");
image(b, 0, 0);
}
«Prev
Next »
Moderate user : stu.hooper
Forum