L-systems revisited

November 16th, 2009 admin 3 comments

I sat down again to update my ActionScript L-system renderer so that it can use multiple rules and new characters.

Next, I fiddled around a bit with axioms, rules and angles and came up with some pretty cool new curves (if I may say so myself). Check them out below.
I’ve also added the renderer application, if you run it you can play around with the curves (controls are listed at the bottom of the app). If it is too slow, please decrease the number of iterations or resize the window to be smaller.

Read more…

Categories: art & technology, l-systems, programming Tags:

Drawing roots

September 1st, 2009 admin 1 comment

If you’ve ever felt the urge to draw plant roots, now’s your chance!

Categories: programming Tags:

Placebo Interactive Video

August 28th, 2009 admin 2 comments

Placebo has released a new single called “The Never-Ending Why”, which is accompanied by a fantastic music video, created by Champagne Valentine.

We at Random were asked to help in the creation of an interactive video to go alongside the linear video.

After a lot of hard work, the result turned out, if we may say so ourselves, amazingly cool!

Check out the linear video here, and try the interactive here.

Categories: game design, programming, web Tags:

Lightning in AS3

July 30th, 2009 admin 4 comments

I’ve been wanting to do this for a while, but never got around to figuring out how. Until now.

With the help of this post I created a simple but very effective random lightning generator in ActionScript 3.

I was surprised at the simplicity of it, and the clear explanation on drilian.com helped a lot.

So here it is: the lightning generator.

EDIT: per request I’ve put the source files online. Download here.

Categories: programming Tags:

L-system animation

July 30th, 2009 admin No comments

A long while ago I wrote a small Flex application to draw L-systems (post).
With this app I noticed how cool it is to play around with drawing angles by moving the slider (post #2).

But somehow, I never thought of adding a play button to the slider so it plays it as an animation.
So now I did. Well, no play button, but just an animation. Here it is. Please enjoy.

lsystem animator

Note: after clicking once, you can use the + and – keys to speed it up or slow it down

Categories: generative art, l-systems, programming Tags:

Central America kicks ass

June 20th, 2009 admin No comments

Wow, I noticed my blogging frequency has really been dropping lately.

Might be due to the fact that I´ve been travelling through Central America with my girlfriend for the past three months. And now it´s almost time to go home, but I can´t complain after having had the opportunity to visit Belize, Guatemala, Honduras, Nicaragua and Costa Rica. Life is good :)

I just want to let everyone know that Central America kicks major ass! I love it here, and will definitely ensure many returns in the future.

Read all about our journey on www.reisabit.com if you can read Dutch, or just enjoy the photos on there (select the central tab, which says ´reisverhalen´).

Categories: travel Tags:

stage scaleMode and stage size problems in Firefox

March 19th, 2009 admin 1 comment

Have you ever had the problem that, when opening the HTML that displays your Flash movie in the browser, all the stuff that is on stage i not positioned correctly?

I have. I encountered this problem with Firefox, when I noticed that objects were not centered on stage while this was the case when I ran the swf standalone or in Safari.

I managed to isolate the problem, and it turned out that what caused it was setting stage.scaleMode to StageScaleMode.NO_SCALE. After doing that, the stageWidth and stageHeight property values changed to zero.
It turned out that this could be solved by not implementing swfobject, but I didn’t want that, so I found a workaround in AS3.

To hack around this problem, I check the stageWidth and stageHeight values to see if either equals 0, and if so, I register a resize event listener, because I found that although the values become zero in Firefox, a resize event is also immediately dispatched after this. So setting a listener for this event and initializing the application inside the handler method solved my problem! Of course, you also want to trigger the handler manually in case there’s no bug, so I just call it directly if neither stageWidth or stageHeight equals 0.

Simple, huh? I know it’s a hack and I’d rather not need it, but at least my application behaves like I want it to now :)

Here’s the code:

public function Application()
{
    stage.align = StageAlign.TOP_LEFT;
    stage.scaleMode = StageScaleMode.NO_SCALE;
    if (stage.stageWidth == 0 || stage.stageHeight == 0)
    {
        stage.addEventListener(Event.RESIZE, handleStageResize);
    }
    else
    {
        handleStageResize();
    }
}

private function handleStageResize(event : Event = null) : void
{
    stage.removeEventListener(Event.RESIZE, handleStageResize);
    // initialize application here
}

Categories: programming Tags:

PaperVision3D one to one pixel representation

February 24th, 2009 admin 3 comments

It was hard for me to find the correct camera settings in papervision to achieve a one to one pixel representation of my objects at z = 0, so here they are:

camera.focus = 10;
camera.zoom = 100;

Voilá! Now move your DisplayObject3D to x, y and z = 0 and you should see it at its actual pixel size.

Categories: programming Tags:

Microphone activityLevel in Flash

January 14th, 2009 admin 10 comments

I wanted to analyse the frequencies of the microphone input in Flash, but guess what? You can’t!

With streaming sound it’s no problem, as this tutorial shows. But surprise: the microphone input is not accessible so you can’t respond to specific frequencies in you live sound input. Crap.

Anyway, after discovering this I set out to simply use the volume of the input, which is represented in the activityLevel property of the Microphone class. When activity is registered (you can set a threshold volume above which it does so), the ActivityEvent.ACTIVITY is dispatched, so you can respond to that.

Get ready for my next surprise: I only see the event being dispatched when my security settings panel is open, and then only when the microphone tab is active! Wtf is going on here?!

After battling with this, and trying out different possible solutions, it turns out that to make it work, you need to have set the loopback setting to true (microphone.setLoopBack(true)). This means that the microphone input will be played back over your speakers.

Needless to say you won’t always want this to happen. In fact, you probably néver want this to happen (think of the feedback!), but apparently you have to in order to be able to read the input volume at all.

Luckily the solution is fairly straightforward: set the soundTransform property of the microphone to a SoundTransform instance with volume zero and presto: no mic sound playing back through your speakers, but an ActivityEvent.ACTIVITY event triggering nonetheless.

Categories: programming Tags:

setTimeOut crashes Flash player

December 2nd, 2008 admin No comments

I just spent the best part of the morning fixing a bug in a website that made my browser crash when I was trying to play a video in Flash using the FLVPlayback component.

What turned out to be the problem? Well, it was the fact that we used the built-in setTimeOut method to keep checking the buffering progress of the video. It would crash Flash player without exception. I removed the call to this method and replaced it by an enter frame listener, and now it works like a charm. No more crashing.

I haven’t tested it thoroughly yet, but it seemed to appear after I had upgraded to Flash CS4, making Flash Player 10 a suspicious candidate. So my suggestion is: avoid this utility method where possible!

Categories: programming Tags: