-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzigzag.pde
38 lines (33 loc) · 1.38 KB
/
zigzag.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
import java.util.List;
void zigzagscrape(int zig) {
// scrape for the strips
loadPixels();
if (testObserver.hasStrips) {
registry.startPushing();
List<Strip> strips = registry.getStrips();
// yscale = how many pixels of y one led strip == float(strips.size())
// xscale = how many pixels of x one led pixel == float(strips.get(0).getLength())
float zigWidth = (float(strips.size())*zig); // 8*4=32
float zigHeight = (float(strips.get(0).getLength())/zig); // 160/4=40
float xscale = float(width) / zigWidth; //10
float yscale = float(height) / zigHeight; //10
// for each strip
int stripNum = 0;
for (Strip strip : strips) {
for (int zag = 0; zag < zig; zag++) {
for (int ledNumZag = 0; ledNumZag < zigHeight; ledNumZag++) {
if (zag%2 == 0) {
color c = get(int((float(stripNum)*zig+zag)*xscale), int((zigHeight-float(ledNumZag))*yscale)); //vertical orientation
strip.setPixel(c, int(ledNumZag+(zag*zigHeight)));
}
if (zag%2 == 1) {
color c2 = get(int((float(stripNum)*zig+zag)*xscale), int((float(ledNumZag))*yscale)); //vertical orientation
strip.setPixel(c2, int(ledNumZag+(zag*zigHeight)));
}
// strip.setPixel(c, int(ledNumZag+(zag*zigHeight)));
}
}
stripNum++;
}
}
}