Archive for the ‘Actionscript’ Category

Bezier animation fun!

Published by Ronny on March 3rd, 2009 in Actionscript, Experiments. 9 comments

Last week I went to FITC in Amsterdam. It was great! I had such a great time. I met a lot of intresting people and although Amsterdam turned out to be quite expensive place, I really liked being there a few days.

During the conference I attended Joshua Davis‘ session which really inspired me. I’ve never seen Joshua Davis present, nor did I know his work. Let me be as crystal clear about this as I can be: The man is a freakin’ genius!
During his session he showed a few demo’s of bezier animated stuff. I felt like trying that myself, and this is what I came up with.

The basic concept is to create a bezier in Actionscript and animating movieclips using the bezier as its motion path.

  • Basic principle (this is actually just a basic pentool (without the option of adding new points :-P ))

The following versions use the same concept as this one, except instead of fixed anchor points, they all use random points defined in 2 planes. This makes a bit of variety possible allthough the main animation stays the same and that’s absolutely cool!

I added a few keyboard controls to give you some control of what is happening

  • spacebar = show the handles
  • r = clear the bitmap
  • p = pause the animation
  • n = randomize handles
  • b = blur more

World360: Unbugged and kicking!

Published by Ronny on February 20th, 2009 in Actionscript, Experiments, Flash. 2 comments

A few days back, I posted the latest update on my World360 project (aka ‘stereographic projection‘… That’s what it is actually called). What this thing actually does is it turns a 360° panorama image into a stereographic projection. The idea is to render this real time (just for the fun of doing it) (I am thinking about doing more with this though…)

stereographicprojection

A few days back I ran into a (at that time) weird problem where transparency was rendered black after a few frames. I had a hard time figuring out what was going on, and I just didn’t have a clue where to start looking. Google wasn’t really helping me out either. So I posted my problem on FlashFocus but nobody came up with the answer to my problem. Peter Elst asked Ralph Hauwert if he already had run into this problem. Mario Klingemann suggested that there might be a problem with the premultiplied alpha. At that time I didn’t know what premultiplied alpha was and seen as the problem resembled the example Mario gave, it seemed quite obvious he was right.

So I took peace with this, and decided to fall back to a non-transparent image format like JPEG. 2 days later Erwin Verdonk came up with the answer to the whole problem… I just had a hard time understanding it…

The root of the problem was me: I had totally forgotten that the draw() method of the BitmapData class didn’t clear the pixels before drawing… Yea, that’s emberassing, right?

But okay… That took care of some problems. I rewrote some of the code, and adjusted some settings.
The speed and the result are quite okay right now. However using 450MB and up of RAM usage might be a bit of a killer.
I’m wondering if I could take care of this using PNGencoder or perhaps JPGencoder.

But for now I’m happy… The final result (for now) can be seen here.

Thanks everybody for helping me out. You guys rock!

PS: The picture used in this experiment was taken by Thomas Heylen. Thanks Thomas!

World360 update, now with PNG bug!

Published by Ronny on February 14th, 2009 in Actionscript, Experiments. 10 comments

Yesterday I decided to get back to my so called ‘World360′ experiment. I wanted to speed up the pre-rendering engine. I managed to do that, with some amazing results: Up to 3 times faster overall. Peaks of 800% speed gain!

You can view the previous version here.
The latest version can be viewed here.

I’m very happy with that, but there’s one little problem. I started to notice a very ugly black border around redrawn PNG transparency (which happens when the animation is pre-renderd).

Result without redrawing bitmap

Result without redrawing bitmap (aka: real time rendering)

Result when redrawing the bitmap

Result when redrawing the bitmap (aka pre-rendering)

Read the rest of this entry »

Webcam motion detection coolness

Published by Ronny on January 18th, 2009 in Actionscript, Open-source, download. 6 comments

Webcam motion detection: step by step development

A few weeks ago I had to create an innovative way to scroll in a page. I have seen tons of scrollbars in Flash and I found it hard to create something completely new. At one point I wondered if I could wire the scrollbar to a webcam using Actionscript… So I started experimenting around…

When I first started I quickly ran into a problem: How the hell do I know if anything is moving? So I actually got stuck right in the beginning.
I went on a Google trip which led me to Koen’s post about motion detection. Koen was checking all the pixels (using nested loops) to calculate color values. I figured this generated way too much overhead. There had to be a better/simpeler way.

In his post Koen mentioned an article, written by Guy Watson, concerning an other way to get motion detection going. To make things simple: Guy just takes 2 pictures – one of the previous frame, one of the current – puts them on top of eachother, and applies the difference blend mode to the upper one: Tadaaa! There we go! The ‘unchanged’ pixels are blacked out. The remaining pixels are the difference in the picture… which reflects movement. Read the rest of this entry »

Visualizr source

Published by Ronny on January 7th, 2009 in Actionscript, Flash. 3 comments

A few people asked me for the Visualizr source. I always said I’d post it on my blog ‘pretty soon’… Well… It’s not pretty soon, but at least I didn’t totally forget about it. Anyway here’s the Actionscript class I made in a Flex Actionscript project :)

I did some pretty naughty things in there, but it worked out the way I wanted it… So be nice :p
Make sure you have got the MP3 tracks in place ;) You’ll need at least one. Make sure you change the tracknames too.