/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://uclaspring12.sketchpad.cc/sp/pad/view/ro.Odl4YcWcanW/rev.260
*
* authors:
* Michelle Lin
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// S U B M A R I N E
// fish appear and fade into the background to make room for more fish to appear and fade into the background...
/* @pjs preload="/static/uploaded_resources/p.4528/1.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/2.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/3.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/4.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/5.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/6.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/7.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/8.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/9.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/10.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/11.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/12.gif"; */
/* @pjs preload="/static/uploaded_resources/p.4528/sub_back_3.png"; */
PImage subm; // submarine background
PImage[] images = new PImage[12]; // array of images (in sequence)
int i = 1;
int f = 200;
void setup() {
size(1200,300);
frameRate(1);
smooth();
for( int i = 1; i < images.length; i++) { //load the image sequence
images[i] = loadImage("/static/uploaded_resources/p.4528/" + i + ".gif");
}
subm = loadImage("/static/uploaded_resources/p.4528/sub_back_3.png");
fill(199, 214, 237);
rect(0,0,1200,300);
image(subm, 0, 0);
}
void draw() {
float x = random(0, f);
float x2 = random(f, 2*f);
float x3 = random(2*f, 3*f);
float x4 = random(3*f, 4*f);
float x5 = random(4*f, 5*f);
float x6 = random(5*f, width);
float y = random(75, 275);
float y1 = random(75, 275);
float y2 = random(75, 275);
float y3 = random(75, 275);
float y4 = random(75, 275);
float y5 = random(75, 275);
float s1 = random(20, 300); //for width of image
float s2 = random(20, 300); //for width of image
float s3 = random(20, 300); //for width of image
float s4 = random(20, 300); //for width of image
float s5 = random(20, 300); //for width of image
float s6 = random(20, 300); //for width of image
image(images[(int)random(1,12)], x, y, s1, s1);
image(images[(int)random(1,12)], x2, y1, s2, s2);
image(images[(int)random(1,12)], x3, y2, s3, s3);
image(images[(int)random(1,12)], x4, y3, s4, s4);
image(images[(int)random(1,12)], x5, y4, s5, s5);
image(images[(int)random(1,12)], x6, y5, s6, s6);
//AQUA -----maybe change waves of transparency?? blueish see through
// light blue: H: 216 S: 17 B: 91
// darkish blue: H; 216 S: 53 B: 96
// so to get randomly generated transparencies
float a = random(10, 30);
float R = random(142, 192);
float G = random(182, 213);
fill(R, G, 245, a);
rect(0, 0, 1200, 300);
// BACKGROUND
image(subm, 0, 0);
}
void mousePressed() {
redraw();
}