Generate dynamic reflections in Flash

Generate dynamic reflections in Flash

While working on a comp for SLRPlayground I came up with a few ideas. One of which is reflections in Flash automatically generated in code so I can keep the galleries dynamic.

A side benefit to working on this experiment was getting a chance to use the Matrix Class in Actionscript. I got a lot of help from this article by the one and only Senocular.

Here is some example code from this experiment which basically takes a clip and flips it over to create a reflection. I then use a Gradient mask (created entirely in Code) to blend in the reflection and add to the realism.

import flash.geom.*
var matrix = {a:1.0, b:0, u:0, c:0, d:-1.0, v:0, tx:0, ty:(image._height*2)+2, w:0};
var reflectionTrans:Transform = new Transform(mcReflectionHolder);
reflectionTrans.matrix = matrix;

Screenshot of the program

I will be adding more code from this project and also look out for a tutorial on Scriptplayground covering some of these techniques.

1 Comment

  • naisioxerloro

    November 28, 2007 10:50 am

    Good design, who make it?