"that takes masking into account, it takes masks into account" - some days I'm like a broken record lol
On Tue, Apr 28, 2009 at 11:28 AM, Hans Wichman < j.c.wich...@objectpainters.com> wrote: > Hi Natalia, > > I recently wrote a reflection class that takes masking into account, it > takes masks into account, hope it helps: > http://objectpainters.com/blog/2008/11/23/visual-reflections-in-as2/ > > Gots lots of samples in the zip including video. > > greetz > JC > > On Tue, Apr 28, 2009 at 10:26 AM, natalia Vikhtinskaya < > natavi.m...@gmail.com> wrote: > >> Hi to all >> >> I use reflection effect for video. But I want to draw not horizontal >> line between video and reflection Mc. So I mask my video with shape: >> >> var distance:Number=20; >> function drawShapeMask(mc:MovieClip, startX:Number, startY:Number, >> w:Number, h:Number) { >> mc.beginFill(0xFF0000); >> mc.moveTo(startX, startY); >> mc.lineTo(startX + w, startY); >> mc.lineTo(startX + w, startY + h); >> mc.lineTo(startX, startY + h-distance); >> mc.lineTo(startX, startY); >> mc.endFill(); >> } >> Now bottom line of video has an angle. >> >> Reflection code works correctly without masked video. With masked >> video it shows only half of video without gradient mask. >> This is how that looks http://www.natavi.co.uk/test/reflect.jpg >> . >> What is wrong? Maybe I can create the same angle position between >> video and reflection without using mask? >> >> >> var reflectionDropoff:Number=1.1; >> var reflectionAlpha:Number=50; >> >> >> reflectIt=function(){ >> var bounds = new Object(); >> bounds.width = myVideo_mc._width; >> bounds.height = myVideo_mc._height; >> matrixHeight = bounds.height/reflectionDropoff; >> var myBitmapData = new flash.display.BitmapData(bounds.width, >> bounds.height, true, 0xFFFFFF); >> myBitmapData.draw(myVideo_mc); >> var reflect=this.createEmptyMovieClip("reflect", 10); >> reflect.attachBitmap(myBitmapData, 1); >> reflect._yscale = -100; >> reflect._x =myVideo_mc._x; >> reflect._y =myVideo_mc._y+(bounds.height*2)-distance; >> reflect._alpha = reflectionAlpha; >> var gra=this.createEmptyMovieClip("gra", 15); >> var fillType = "linear"; >> var colors = [0xFFFFFF, 0xFFFFFF]; >> var alphas = [80, 0]; >> var ratios = [0, 255]; >> var matrix = {matrixType:"box", x:0, y:0, w:bounds.width, >> h:matrixHeight, r:(90/180)*Math.PI}; >> var spreadMethod:String = "pad"; >> gra.beginGradientFill(fillType, colors, alphas, ratios, matrix, >> spreadMethod); >> gra.moveTo(0, 0); >> gra.lineTo(bounds.width, distance); >> gra.lineTo(bounds.width, bounds.height); >> gra.lineTo(0, bounds.height); >> gra.lineTo(0, 0); >> gra.endFill(); >> gra._y = reflect._y - reflect._height; >> gra._x = reflect._x; >> reflect.cacheAsBitmap = true; >> gra.cacheAsBitmap = true; >> reflect.setMask(gra); >> this.onEnterFrame = function () >> { >> myBitmapData.draw(myVideo_mc); >> }; >> >> } >> >> Thanks for any help! >> _______________________________________________ >> Flashcoders mailing list >> Flashcoders@chattyfig.figleaf.com >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> > > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders