-
Notifications
You must be signed in to change notification settings - Fork 1
/
drawmation.java
66 lines (56 loc) · 1.2 KB
/
drawmation.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import processing.core.*;
import processing.xml.*;
import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
import java.util.regex.*;
public class drawmation extends PApplet {
// Jason L. German \u00a9 2010
int currentFrame = 0;
PImage[] frames = new PImage[3];
int lastTime = 0;
public void setup()
{
size(1440,900);
strokeWeight(1);
smooth();
background(255,255,255);
for (int i = 0; i < frames.length; i++) {
frames[i] = get();
}
}
public void draw()
{
int currentTime = millis();
if (currentTime > lastTime+30) {
nextFrame();
lastTime = currentTime;
}
if (mousePressed == true) {
line(pmouseX, pmouseY, mouseX, mouseY);
}
}
public void nextFrame()
{
frames[currentFrame] = get();
currentFrame++;
if (currentFrame >= frames.length) {
currentFrame = 0;
}
image(frames[currentFrame], 0, 0);
}
public void keyTyped()
{
save("thing.png");
noFill();
}
static public void main(String args[]) {
PApplet.main(new String[] { "--present", "--bgcolor=#666666", "--stop-color=#cccccc", "drawmation" });
}
}