09
Dec
08

Fun with Flash: Assembler

Have you ever wanted to take some element, and then make a cool animation where it is assembled from a thousand different pieces? Well, me neither, until I saw a cool video of it. Then I wanted to see if I could make a Flash tool for it. Take a look at the result here.

Screenshot

Getting it to work
The first issue was to figure out where all the squares would have to go. On a suggestion from a colleague, I tried to use flocking to find the positions, which is why the source contains all the code necessary to make the blocks behave like boids :)

However, I quickly realized, that what I would achieve with flocking could much more easily be determined simply by finding pixels that were colored, as those represent the final text. By adding in a check that surrounding pixels also had to be colored, the blocks more or less would end up within the desired shape.

Tweens
Have you written code like “if( show && alpha < 1 ){ alpha += 0.1; }” many, many times? I have, and although you can fade in or out something with few lines of code, it gets old fast and adds some complexity to code that really should be about something else than fading in or out.

When I found this tweener library I was quickly sold. Not only will it let you easily fade things in and out, but it also allows for lots of other cool effects using many different transitions. I’ve added some of these transitions to the dropdown in Assembler, and the rest are trivial to add. For being trivial, they sure add some great effects and can change the overall feeling a lot.

End transition
Even with this effort and a great tween library, the squares still won’t fit the text completely. My solution here is to use PixelDissolve from one BitmapData to another, but it still looks a bit weird. I’ve thought about some better solutions, and will bring an update if I get around to trying them out.

Possible uses?
I only did this for fun and to see if I could. I never really thought about what it could be used for. If you have some ideas for games or anything cool this could be used for, then please let me know. I would love the inspiration :)

Download Source

About these ads

3 Responses to “Fun with Flash: Assembler”


  1. 1 jason
    December 26, 2008 at 6:56 pm

    Tweener is awesome the best part about is that you can have it modify any property of an object. It’s also a set it and forget type affair, it just works, I love you can add tweens to an already running tween on an object and it looks good, it pretty much gets added to all my projects.

  2. February 15, 2009 at 11:30 pm

    Hi Jonas,
    I had a look at your code. Very interesting. Could have found a use for it – see my blog – but didn’t continue that line of thinking when combining it with many other elements appeared to be too CPU intensive.

    Best regards,
    Rudi


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


December 2008
M T W T F S S
     
1234567
891011121314
15161718192021
22232425262728
293031  

Months


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: