var xp:Number = 0;
var yp:Number = 0;
var t:Number = 0;
var r:Number = 200;
x = stage.stageWidth / 2;
y = stage.stageHeight / 2;
graphics.lineStyle(0,0x000000);
addEventListener(Event.ENTER_FRAME, onRun);
function onRun(evt:Event):void {
r = 200 * Math.cos(t / 10);
xp = r * Math.pow(Math.cos(t), 3);
yp = r * Math.pow(Math.sin(t), 3);
if (t == 0){
graphics.moveTo(xp, yp);
}else{
graphics.lineTo(xp, yp);
}
t += 0.1;
}
While browsing mathworld I decided to do a variation on this curve . The above snippet will draw something like this:
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
So there are 434 posts on this site to date. I hope to keep posting but it isn’t always easy to come up with new ideas. Another project I’ve been working on is a series of drawings and interactive animations over at my other website (shapevent). I’ve been creating entries for this part of shapevent pretty regularly – go have a look:
var circles:Array = [];
for (var i:int = 0; i<30; i++){
var c:Sprite = makeCircle();
c.x = stage.stageWidth / 2;
c.y = stage.stageHeight / 2;
c.scaleX = 1 + i/2;
c.scaleY = 0.5 + i/4;
addChild(c);
circles.push(c);
}
addEventListener(Event.ENTER_FRAME, onLoop);
function onLoop(evt:Event):void {
circles[0].y += (mouseY - circles[0].y) / 4;
for (var i:int = 1; i<circles.length; i++){
var pre:Sprite = circles[i - 1];
circles[i].y += (pre.y - circles[i].y) / 4;
}
}
function makeCircle():Sprite{
var s:Sprite = new Sprite();
with(s.graphics){
lineStyle(0,0x000000);
drawCircle(0,0,10);
}
return s;
}
This morning I woke up with a vision of this simple mouse toy in my head. I decided I might as well code it up… I may do more simple things like this in the next few days, it’s relaxing.
var word:String = "TextLineMetrics are useful";
var letters:Array = word.split("");
var pre:TextField;
for (var i:int = 0; i<letters.length; i++){
var t:TextField = new TextField();
t.defaultTextFormat = new TextFormat("Arial", 40);
t.autoSize = TextFieldAutoSize.LEFT;
t.textColor = int(Math.random() * 0xFFFFFF);
t.text = letters[i];
if (pre){
var metrics:TextLineMetrics = pre.getLineMetrics(0);
t.x = metrics.width + pre.x;
}
pre = t;
addChild(t);
}
Sometimes you need to do something to a TextField one letter at a time. One way to do this is to create a separate TextField for each letter and position them based on the TextLineMetrics object. This snippet creates textFields for a string and colors each TextField randomly.
When I first created QuickBox2D I simultaneously developed a simple editor to aid in the creation of complex simulations. The result is very alpha and should be used cautiously. There is no UI, it is entirely key controlled. It generates actionscript files that can be copy and pasted into working simulations. It also has a preview mode for previewing simulations as you develop them. This is by no means a full featured editor, there is a good deal of work to be done on it. I am releasing the code as a simple zip for people who would like to develop it further. If there is enough interest I’ll create some kind of code repositiory, but for now I’m just releasing the below zip.
I may post further instructions for the editor in the future… Remember to save your work frequently and to create new versions for every change that you make to a file.
Suggested Features:
Simple GUI
Base64 encoding for get string
Known Issues:
Making joints that don’t touch things can break the preview app.
I’ll be doing a drawing performance using something I created called Gesture Capture tomorrow April 9th in Brooklyn at the former Engine Co. 212 firehouse. The performance will happen at random intervals between 6pm and 10pm. There will be two other performances going on by Julie Fotheringham, Vera Angelica and Zahava Rozman. Here is some additional information: