Hyperspace starfield

Recently I encountered one of those timed programming-tests they occasionally do as part of an interview-process. Even though my solution was deemed a success, I personally felt somewhat dissatisfied with my approach to the presented problem.
Sure, the time available was severely limited, but I couldn’t help but feel frustrated by the under-the-hood clunkiness of the end-result, so I decided to redo it the “proper” way for the sake of my inner tranquility, and for the benefit of all mankind. :D

Lo and behold this starfield-effect:

Unlike the original submitted for the above-mentioned test, this one I actually consider to be a pretty solid version.
Even though the framerate of this SWF is capped at 30fps and the number of stars limited to 1000 for the sake of usability, on my (not particularly cutting-edge) system it still runs at a glossy 60fps with 1500 stars.

I even added little performance-leeching extra features, like the cool “redshift” trail-effect, or the elliptical movement of the stars’ point of origin.

And now onto the code. One noteworthy detail is the heavy-duty use of Flash10′s new Vector class – essentially a fast, typed array – which contributes to the nice performance-results:

…and here’s the additional little class which is used for each individual star:

3 Responses to Hyperspace starfield

  1. Kathleen says:

    I’m just starting to learn AS after animating time line in Flash for years.Thanks for all the cool stuff you are posting

  2. Og2t says:

    I like the red trails a lot! Thanks for posting.

  3. zizi says:

    Hi bro..Im sucks at AS…could email me the .fla
    Your work is a total madman genius…

    Please email to : efxtive@gmail.com

    thanks a bunch bro…i love u

Leave a Reply

Recent Posts