| 1 | class Sandbox extends SCPattern |
| 2 | { |
| 3 | int c=0; |
| 4 | int prevC=0; |
| 5 | int huerange=255; |
| 6 | int pointrange= model.points.size(); |
| 7 | int striprange= model.strips.size(); |
| 8 | int facerange= model.faces.size(); |
| 9 | int cuberange = model.cubes.size(); |
| 10 | int towerrange = model.towers.size(); |
| 11 | int counter=0; |
| 12 | |
| 13 | Sandbox(GLucose glucose) { |
| 14 | super(glucose); |
| 15 | println("points "+pointrange); |
| 16 | println("strips "+striprange); |
| 17 | println("faces "+facerange); |
| 18 | println("cubes "+cuberange); |
| 19 | println("towers "+towerrange); |
| 20 | } |
| 21 | |
| 22 | public void run(int deltaMs) { |
| 23 | |
| 24 | |
| 25 | if(counter % 10 ==0) |
| 26 | { |
| 27 | doDraw(c,0); |
| 28 | c = (c + 1) % towerrange; |
| 29 | long col = color(Math.round(Math.random()*255),255,255) ; |
| 30 | doDraw(c,col); |
| 31 | } |
| 32 | counter++; |
| 33 | |
| 34 | } |
| 35 | |
| 36 | public void doDraw(int c,long col) |
| 37 | { |
| 38 | Tower t= model.towers.get((int) c); |
| 39 | for(Point p : t.points) |
| 40 | { |
| 41 | colors[p.index] = (int) col; |
| 42 | } |
| 43 | } |
| 44 | }; |
| 45 | |
| 46 | class GranimTestPattern extends GranimPattern |
| 47 | { |
| 48 | GranimTestPattern(GLucose glucose) |
| 49 | { |
| 50 | super(glucose); |
| 51 | RedThreeGraphic myReds = new RedThreeGraphic(); |
| 52 | addGraphic("myThreeReds",myReds); |
| 53 | } |
| 54 | int counter=0; |
| 55 | public void run(int deltaMs) |
| 56 | { |
| 57 | super.run(deltaMs); |
| 58 | if(counter % 3 ==0) |
| 59 | { |
| 60 | getGraphicByName("myThreeReds").position++; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | |
| 65 | } |