Anonymous avatar Anonymous committed 8631a8c

place data in data folder

Comments (0)

Files changed (2)

 def serve_pjs(filename):
     return static_file(filename, root='./pjs')
 
+# dull way to serve pjs data
+@route('/canvas/data/:filename')
+def serve_pjs_data(filename):
+    return static_file(filename, root='./pjs/data')
+
 @route('/')
 @view('index')
 def index():
     # scan dir to seek pjs
     pjslist = [name.split('.')[0] for name in os.listdir('./pjs')\
-               if not name.startswith('.')]
+               if name.endswith('.pjs') or name.endswith('.pde')]
     return dict(pjslist=pjslist)
 
 @route('/canvas/:iname')
 int barWidth = 2;
 int [] hueArr;
 boolean needUpdate = true;
+int inttimer = 0;
+int iterix = 0;
 
 void setup() {
     size(320, 480);
     for (int ix = 0; ix < hueArr.length; ++ix) {
         hueArr[ix] = ix * barWidth;
     }
+    miltimer = 0;
 }
 
 void draw() {
         needUpdate = false;
         noStroke(); 
         for (int ix = 0; ix < hueArr.length; ++ix) {
-           fill(hueArr[ix], 100, 100);
+           fill(hueArr[ix], 80, 60);
            rect(ix*barWidth, 0, barWidth, height);
         }
     }
-    // update
-    aldfjalskdjf;
+    // timed update
+    if (inttimer++ > 2) {
+        // iterate and change color
+        hueArr[iterix] = random(width);
+
+        // set update
+        iterix = (iterix + 1) % hueArr.length;
+        needUpdate = true;
+        inttimer = 0;
+    }
+    
 }
 
-void drawOnce() {
-    
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.