158
edits
Line 4: | Line 4: | ||
== Homework 1 == | == Homework 1 == | ||
As a homework I created a slideshow of pictures I took in Ilmpark | |||
[[File:Parksession.gif|left|frame]] | [[File:Parksession.gif|left|frame]] | ||
<br style="clear:both;"> | |||
source code: | |||
<source lang="java"> | |||
PImage img1; | |||
PImage img2; | |||
PImage img3; | |||
PImage img4; | |||
PImage img5; | |||
PImage img6; | |||
PImage img7; | |||
PImage img8; | |||
PImage img9; | |||
int frame; | |||
void setup() { | |||
size(400, 400); | |||
background(0, 0, 0); | |||
frameRate(3); | |||
frame = 1; | |||
img1 = loadImage("r1.jpg"); | |||
img2 = loadImage("r2.jpg"); | |||
img3 = loadImage("r3.jpg"); | |||
img4 = loadImage("r4.jpg"); | |||
img5 = loadImage("r5.jpg"); | |||
img6 = loadImage("r6.jpg"); | |||
img7 = loadImage("r7.jpg"); | |||
img8 = loadImage("r8.jpg"); | |||
img9 = loadImage("r9.jpg"); | |||
} | |||
void draw() { | |||
if (frame > 9) { | |||
frame = 1; | |||
} | |||
if (frame == 1) { | |||
image (img1, 0, 0, 400, 400); | |||
} | |||
if (frame == 2) { | |||
image (img2, 0, 0, 400, 400); | |||
} | |||
if (frame == 3) { | |||
image (img3, 0, 0, 400, 400); | |||
} | |||
if (frame == 4) { | |||
image (img4, 0, 0, 400, 400); | |||
} | |||
if (frame == 5) { | |||
image (img5, 0, 0, 400, 400); | |||
} | |||
if (frame == 6) { | |||
image (img6, 0, 0, 400, 400); | |||
} | |||
if (frame == 7) { | |||
image (img7, 0, 0,400, 400); | |||
} | |||
if (frame == 8) { | |||
image (img8, 0, 0,400, 400); | |||
} | |||
if (frame == 9) { | |||
image (img9, 0, 0, 400, 400); | |||
} | |||
frame = frame + 1; | |||
} | |||
</source> | |||
== Homework 2 == | == Homework 2 == |
edits