|
11 | 11 | */ |
12 | 12 |
|
13 | 13 | // The shape |
14 | | -PShape pentagram; |
| 14 | +PShape uk; |
15 | 15 |
|
16 | 16 | void setup() { |
17 | | - size(600, 400); |
18 | | - // Load teh shape |
19 | | - pentagram = loadShape("pentagram.svg"); |
| 17 | + size(640, 360); |
| 18 | + // Load the shape |
| 19 | + uk = loadShape("uk.svg"); |
20 | 20 | } |
21 | 21 |
|
22 | 22 | void draw() { |
23 | | - background(0); |
| 23 | + background(51); |
| 24 | + // Center where we will draw all the vertices |
| 25 | + translate(width/2 - uk.width/2, height/2- uk.height/2); |
| 26 | + |
24 | 27 | // Iterate over the children |
25 | | - int children = pentagram.getChildCount(); |
| 28 | + int children = uk.getChildCount(); |
26 | 29 | for (int i = 0; i < children; i++) { |
27 | | - PShape child = pentagram.getChild(i); |
| 30 | + PShape child = uk.getChild(i); |
28 | 31 | int total = child.getVertexCount(); |
29 | | - // The vertices of each child |
| 32 | + |
| 33 | + // Now we can actually get the vertices from each child |
30 | 34 | for (int j = 0; j < total; j++) { |
31 | 35 | PVector v = child.getVertex(j); |
32 | | - stroke(255); |
33 | | - strokeWeight(4); |
34 | | - ellipse(v.x, v.y, 16, 16); |
| 36 | + // Cycling brightness for each vertex |
| 37 | + stroke((frameCount + (i+1)*j) % 255); |
| 38 | + // Just a dot for each one |
| 39 | + point(v.x, v.y); |
35 | 40 | } |
36 | 41 | } |
37 | | - |
38 | | - /* |
39 | | - // You could also get the "tessllation" |
40 | | - // which is a single shape of all the vertices |
41 | | - PShape tes = pentagram.getTessellation(); |
42 | | - int total = tes.getVertexCount(); |
43 | | - for (int j = 0; j < total; j++) { |
44 | | - PVector v = tes.getVertex(j); |
45 | | - point(v.x, v.y, v.z); |
46 | | - }*/ |
47 | 42 | } |
0 commit comments