-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoquaciousAndLovelySimulator2015.pde
54 lines (44 loc) · 1.49 KB
/
LoquaciousAndLovelySimulator2015.pde
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
PShape leftShape;
PShape rightShape;
PImage leftBg;
PImage rightBg;
VStrip leftHead;
VStrip leftFrontLeg;
VStrip leftBackLeg;
VStrip rightHead;
VStrip rightFrontLeg;
VStrip rightBackLeg;
Arduino arduino;
void setup() {
frameRate(45);
size(1360,394);
// The vertexes in the SVG paths are used to
// define where LEDs go
leftShape = loadShape("left.svg");
rightShape = loadShape("right.svg");
leftBg = loadImage("left.jpg");
rightBg = loadImage("right.jpg");
// The virtual arduino sketch will instantiate a
// bunch of LPD8806s in its setup() method
arduino = new Arduino();
arduino.setup();
// VStrip ties the LPD8806 instances to the SVG paths.
// The last two parameters are offsets to correct lining up with the background.
leftFrontLeg = new VStrip(leftShape.getChild("frontleg"), arduino.leftFrontLeg, -55, -110);
leftBackLeg = new VStrip(leftShape.getChild("backleg"), arduino.leftBackLeg, -55, -110);
leftHead = new VStrip(leftShape.getChild("head"), arduino.head, -55, -110);
rightFrontLeg = new VStrip(rightShape.getChild("frontleg"), arduino.rightFrontLeg, 670, -110);
rightBackLeg = new VStrip(rightShape.getChild("backleg"), arduino.rightBackLeg, 670, -110);
rightHead = new VStrip(rightShape.getChild("head"), arduino.head, 670, -110);
}
void draw() {
arduino.loop();
image(leftBg,0,0);
image(rightBg,width/2,0);
leftFrontLeg.draw();
leftBackLeg.draw();
leftHead.draw();
rightFrontLeg.draw();
rightBackLeg.draw();
rightHead.draw();
}