Now make it move
authorBen Morrow <childoftv@gmail.com>
Sun, 18 Aug 2013 01:56:18 +0000 (18:56 -0700)
committerBen Morrow <childoftv@gmail.com>
Sun, 18 Aug 2013 01:56:18 +0000 (18:56 -0700)
BenMorrow.pde
GranimPattern.pde

index a86189b60e6c47882bb09dc46360441312e2283a..67a1b79c317f7c21d21d0fd84c9b246da00b5426 100644 (file)
@@ -49,7 +49,16 @@ class GranimTestPattern extends GranimPattern
        {
                super(glucose);
                RedThreeGraphic myReds = new RedThreeGraphic();
-               addGraphic("string_name",myReds);
+               addGraphic("myThreeReds",myReds);
+       }
+       int counter=0;
+       public void run(int deltaMs) 
+       {
+               super.run(deltaMs);
+               if(counter % 3 ==0)
+               {
+                       getGraphicByName("myThreeReds").position++;
+               }
        }
 
 
index 2fd33e15c2a0541caef2d33fc09ddea8c70af1af..99d8f402fbdb4dc525f7635adc196fc696cf911a 100644 (file)
@@ -26,6 +26,11 @@ class GranimPattern extends SCPattern
                displayList.put(name,g);
        }
 
+       public Graphic getGraphicByName(String name)
+       {
+               return displayList.get(name);
+       }
+
        public void run(int deltaMs) 
        {
                for(Graphic g : displayList.values())