Jul 16, 2009
Reflection + MovieClip = ReflectionClip
Ever since reflections became all the craze I have always wanted to create a simple Actionscript class to… well make reflections. So I started it about a year ago and it was very scrapped together. I left it alone and then came back to it a couple months ago. I ended up re-writing a lot of it and kept tweaking it until I’ve come up with what I call, ReflectionClip. Check out the example after the jump as well as a more in depth description with code!
ReflectionClip is an Actionscript 3.0 class that was created to ease the development of reflections the programmer. It allows the user to use any DisplayObject as it’s content and automatically creates it’s reflection. The programmer then has the flexibility to use the class via the stage or dynamically via Actionscript. Here’s a quick rundown of it’s features: you can set the strength of the reflection, the spacing, and even apply an array of BitmapFilters onto the reflection. One other nice feature that I like and have shown in the example above is to update the reflection as the content is animating. This is great if you want to add a small but subtle effect to your reflection. Check the code below for an example of how to use this class via Actionscript.
1 2 3 4 5 6 7 8 9 10 11 12 | import com.imperez.display.ReflectionClip; var rClip:ReflectionClip = new ReflectionClip(); rClip.content = new ReflectionContent(); rClip.gradientMask = new GradientMask(); rClip.spacing = 5; rClip.animated = true; rClip.contentHeight = 200; rClip.x = rClip.y = 10; this.addChild(rClip); |
You can check out the class at this page.
Or if you want, you can also download the class from my subversion repository here and the examples can be found here.
I hope that you enjoyed this class and that it helps saves you some time!