Archive for April, 2010

Gesture Capture Pics

Friday, April 16th, 2010

I uploaded some pictures of my Gesture Capture performance to flickr:

Performance Pics

Imperfect Boxes

Wednesday, April 7th, 2010

Today I was thinking about a simple way to draw imperfect boxes and this is what I came up with:

This technique is pretty straight forward and just uses lerp and a random offset:

Actionscript:
  1. graphics.lineStyle(0,0x000000);
  2. rect(this.graphics, new Rectangle(100,100,200,200));
  3. rect(this.graphics, new Rectangle(320, 100, 50, 200), 3);
  4. rect(this.graphics, new Rectangle(390, 100, 50, 200));
  5. rect(this.graphics, new Rectangle(460, 100, 100, 100));
  6. rect(this.graphics, new Rectangle(460, 210, 100, 120));
  7.  
  8. var g0:Shape = makeGrid();
  9. g0.x = 200;
  10. g0.y = 120;
  11.  
  12. var g1:Shape = makeGrid(15, 9, 31);
  13. g1.x = 100;
  14. g1.y = 320;
  15.  
  16.  
  17. function makeGrid(num:int = 9, cols:Number=3, size:Number=30):Shape{
  18.     var grid:Shape = new Shape();
  19.     grid.graphics.lineStyle(0,0x000000);
  20.     
  21.     addChild(grid);
  22.     var smallSize:Number = size - 10;
  23.     for (var i:int = 0; i<num; i++){
  24.         var xp:Number = (i % cols) * size;
  25.         var yp:Number = int(i / cols) * size;
  26.         rect(grid.graphics, new Rectangle(xp,yp,smallSize,smallSize), 3);
  27.     }
  28.     return grid;
  29. }
  30.  
  31. function rect(g:Graphics, rect:Rectangle, res:Number = 8):void{
  32.     var a:Point = new Point(rect.left, rect.top);
  33.     var b:Point = new Point(rect.right, rect.top);
  34.     var c:Point = new Point(rect.right, rect.bottom);
  35.     var d:Point = new Point(rect.left, rect.bottom);
  36.  
  37.     var diff:Number = ( b.x - a.x);
  38.     var dab:Number = int(diff/res);
  39.     var xp:Number, yp:Number;
  40.     var action:String;
  41.     trace(dab);
  42.     for (var i:int = 0; i<dab; i++){
  43.         action = "lineTo";
  44.         if (i == 0){
  45.             xp = a.x;
  46.             yp = a.y;
  47.             action = "moveTo"
  48.         }
  49.         xp = a.x + (diff) * (i/dab);
  50.         yp = a.y + Math.random() * 5 - 2;
  51.         g[action](xp, yp);
  52.     }
  53.     diff = c.y - b.y;
  54.     dab = int(diff / res);
  55.     for (i = 0; i<dab; i++){
  56.         xp = b.x + Math.random() * 5 - 2;
  57.         yp = b.y + (diff) * (i/dab);
  58.         g.lineTo(xp, yp);
  59.     }
  60.     diff = d.x - c.x;
  61.     dab = Math.abs(int(diff / res));
  62.     for (i = 0; i<dab; i++){
  63.         xp = c.x + (diff) * (i/dab);
  64.         yp = c.y + Math.random() * 5 - 2;
  65.         g.lineTo(xp, yp);
  66.     }
  67.     diff = a.y - d.y;
  68.     dab = Math.abs(int(diff / res));
  69.     for (i = 0; i<dab; i++){
  70.         xp = d.x + Math.random() * 5 - 2;
  71.         yp = d.y + (diff) * (i/dab);
  72.         g.lineTo(xp, yp);
  73.     }
  74. }

Synesthesia Sketch

Thursday, April 1st, 2010

I'm slowly working on some software related to synesthesia. This is a very simple but interesting sketch that I created. Clicking once will set the numbers to black, clicking again will associate random colors with the numbers 0-9:

Click numbers to toggle random colors

This movie requires Flash Player 9

This is the first in a series of sketches I'll be doing related to synesthesia.