Rotating 3D Marquee Experiment (with Source)
This swf shows a marquee of letters scrolling across a 3D panel that rotates according to the mouse position. In this post I thought it would be helpful to walk you through how I got to the final swf by combining a few different pieces of code. The swf is a combination of a custom text rendering effect using BitmapData, the DistortImage class, and a simple 3D engine. (All these examples require Flash 8 or higher).
Initially I was experimenting with text effects using the BitmapData object. Using BitmapData can give some interesting raster effects, that you can’t create just with movieclips. With BitmapData you typically want to work on a small canvas, since calculating per pixel effects across a large area can be very CPU intensive.
The idea is to repeatedly copy a blurry letter movieclip into the bitmap using BitmapData.draw() to give the fade in effect. The fade out effect comes from copying in a 5% alpha background color every frame. After playing around for a while I came up with this:

Once I was here I thought it would be nice to give this a perspective effect, like watching a marquee text scroll in Time Square. True perspective effects are the holy grail for Flash developers and have been hard to achieve until recently when the awesome DistortImage class was released by the creators of Sandy (based on orginal code by the genius Andre Michelle). This class will chop up any movieClip or bitmapData into multiple triangles, then skew the triangles to fit any 4 corner points. DistortImage causes image quality loss and rendering artifacts, so this technique is not useful if you want 100% image clarity. I took the bitmapData object and applied it to a DistortImage. I also modified the text effect so that the text now scrolls horizontally.
Once here it was a reasonable leap to have the panel move in a 3d space. For this I could have used Sandy or similar, but really i just need a very simple engine to give a 3d perspective render on the 4 panel corner points. From this list of 3D flash engines, I found Andre Michelle’s Simple 3d Engine. Modifying this to render a plane gives this:
Combining the 3d plane and the DistortImage gives the SWF at top. This required converting the 3D engine to an AS2 class.



February 6th, 2007 at 11:38 am
Amazing all this. Specially the third.
March 5th, 2007 at 8:05 pm
hello. how can i integrate an jpg image into each middle side of the rectangle?
Thanks.
April 9th, 2007 at 9:27 am
[...] Martes, febrero 6th, 2007 in Tecnologia Señores deben ver estos experimentos 3D hechos en Flash por Airtight. Sus trabajos son siempre impresionantes y estos no se quedan atras. Veanlos. [...]
May 16th, 2007 at 12:24 pm
The second swf reminds me of the opening of Good Will Hunting – one of my all time favs. I love the technique. Keep up the great site!
July 31st, 2007 at 2:42 am
hi there i am creating a marquee that load images from XML setting file
i hope u can help me wif it
http://www.mediafire.com/?8gzguhsnjmo
this is part of the completion i have stuck fro 2 month there
thank alot
September 14th, 2007 at 3:10 pm
Thanks
October 9th, 2007 at 10:46 am
thanks. I love the technique.
October 24th, 2007 at 2:04 pm
Thanks, this technic is really perfect…
November 8th, 2007 at 10:00 am
Hi, first really good job, hehe now second…how I can set a symbole who load dynamically an Image in the pane?
thanks!
November 26th, 2007 at 2:48 pm
WoW. That’s good. Thanks…
April 5th, 2008 at 3:18 pm
Sorry. I am not getting how to change out the text. Advice?
April 18th, 2008 at 2:02 pm
yay, exactly what i was looking for, thanks man
April 28th, 2008 at 5:26 pm
Thanks
May 17th, 2008 at 7:49 pm
It’s so good!
July 12th, 2008 at 3:47 pm
a good way to implement 3d into flash, thanxs!
July 15th, 2008 at 3:31 pm
http://www.oyunlars.net
thank you
June 6th, 2009 at 7:47 am
ThanklYou
July 25th, 2009 at 10:46 am
Oh thank you