-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathPainter.pde
41 lines (34 loc) · 898 Bytes
/
Painter.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
class Painter {
int xPos;
int yPos;
int alpha;
int brushResolution;
int videoCounter;
float brushSize;
int numSides = 100;
float theta = TWO_PI / numSides;
Painter(int x, int y, int count, int _brushResolution, int _alpha, float _brushSize) {
xPos = x;
yPos = y;
videoCounter = count;
brushResolution = _brushResolution;
alpha = _alpha;
brushSize = _brushSize;
}
void paint(PImage movie, int brushResolution, int alpha, float brushSize) {
for (int i = 1; i <= brushResolution; i++) {
pushMatrix();
translate(xPos, yPos);
beginShape();
tint(255, alpha/i);
texture(movie);
for (int j=0; j<numSides+1; j++) {
float x = brushSize*sin(j * theta) * log(i+5) ;
float y = brushSize*cos(j * theta) * log(i+5) ;
vertex(x, y, xPos + x, yPos + y);
}
endShape();
popMatrix();
}
}
}