Category Archives: Uncategorized

Quick IE Test

Found this today, not related to actionscript but rather nice. It allows you to take a screen shot of your website in IE… if your on a mac without windows this is a quick way to test in a pinch:

http://ipinfo.info/netrenderer/index.php

Posted in Uncategorized | 6 Comments

Epicycloid Again

Actionscript:
  1. var xp:Number = 0;
  2. var yp:Number = 0;
  3. var t:Number = 0;
  4. var a:Number = 100;
  5. var b:Number = 10;
  6. x = stage.stageWidth / 2;
  7. y = stage.stageHeight / 2;
  8.  
  9. graphics.lineStyle(0,0x000000);
  10. addEventListener(Event.ENTER_FRAME, onRun);
  11. function onRun(evt:Event):void {
  12.     var p:Number = ((a + b)/b)*t
  13.     xp = (a + b) * Math.cos(t) - b * Math.cos(p);
  14.     yp = (a + b) * Math.sin(t) - b * Math.sin(p);
  15.     if (t == 0){
  16.       graphics.moveTo(xp, yp);
  17.     }else{
  18.       graphics.lineTo(xp, yp);
  19.     }
  20.     t += 0.05;
  21. }

I've messed with Epicycloids in the past - browsing mathworld I decided to create this snippet. It will draw a curve like this:

Posted in Uncategorized | Tagged , , | 1 Comment

Color Project

I've been working on a project for the led facade at medialab prado. The project has an online component that allows users to name colors, these names are then searched on twitter and displayed on the led facade. Right now our color database has about 530 colors about 20% of which are in spanish. We're lookiing to get more colors named particularly in spanish. If you feel up to it, you can enter and name colors, simply pick a color, enter your name and name the color... here for spanish
and here for english.

If you did it correctly you'll see your color show up in our list of colors here

Posted in Uncategorized | 1 Comment

Relaxing with Sine and Cosine

Last night I wanted to play with sine and cosine waves so I created this snippet:

Actionscript:
  1. var wave:Number = 0;
  2. addEventListener(Event.ENTER_FRAME, onLoop);
  3. function onLoop(evt:Event):void {
  4.        graphics.clear()
  5.        graphics.lineStyle(0,0);
  6.        var time:Number = (stage.stageWidth/2 - mouseX)/10
  7.        for (var j:int = 0; j<100; j++){
  8.                var offset:Number = j/10;
  9.                var t:Number = 0;
  10.                var wh:Number = j * 4;
  11.                for (var i:int = 0; i<300; i++){
  12.                        wave = cos(10-offset, t + time + offset)
  13.                               + sin(time, t/2 + time - offset) + wh
  14.                               + cos(3, t * 4);
  15.                        t += 0.1;
  16.                        var xoff:Number = i * 2;
  17.                        if (i == 0){
  18.                                graphics.moveTo(100 + xoff, 100 + wave);
  19.                        }else{
  20.                                graphics.lineTo(100 + xoff, 100 + wave);
  21.                        }
  22.  
  23.                }
  24.        }
  25. }
  26.  
  27. function cos(radius:Number, theta:Number):Number{
  28.        return radius * Math.cos(theta);
  29. }
  30. function sin(radius:Number, theta:Number):Number{
  31.        return radius * Math.sin(theta);
  32. }


Have a look at the swf...

Posted in Uncategorized | 4 Comments