Creating a Reflection Effect
My website: ASWC View all articles by Jean André Mas
So let’s start by showing the basic principles behind a simple reflection in Flash. So let’s say we have an object that we want to add a reflection effect to:
Step number 1 is to create a copy of the object:
Step number 2 is to flip the copy. Here the reflection will be at the bottom so we flip the copy vertically:
Step number 3 is to create a gradient:
Step number 4 is to set one color of the gradient to transparent:
Finally set the gradient on top of the flipped copy and set the gradient as a mask for the flipped copy:
So to resume creating a reflection involves a few steps: Create a copy, flip the copy, create a gradient, set one color of the gradient transparent, and then set the gradient as a mask for the flipped copy. Now to translate that into code all we need to do is write a code that does all these steps for us.
It’s important also to notice that the way the reflection looks is completely dependent on the way the gradient is made. The second color of the gradient is fully transparent but what happens if I make the first one 50% transparent?
What happens if I move the gradient up?
So the gradient is the centerpiece of a nice reflection effect. We can move it, set different transparencies for its colors; we could also put the gradient at an angle to get interesting effect and so on. So now it’s time to apply what we learned and get into some coding.