I found that if I use layer mask reflection code works correctly
http://www.natavi.co.uk/test/video_perspective.html

If I try to use script mask over my video clip

var videoMaska=this.createEmptyMovieClip("videoMaska",100);
videoMaska._x=myVideo_mc._x;
videoMaska._y=myVideo_mc._y;
drawShapeMask(videoMaska, 0, 0, myVideo_mc._width,myVideo_mc._height);
myVideo_mc.setMask(videoMaska);

Result is wrong
http://www.natavi.co.uk/test/video_perspective_wrong.html







2009/4/28 Hans Wichman <j.c.wich...@objectpainters.com>:
> Hmmm,
> might be that some values end up negative while they shouldn't or as floats
> while they should be integers.
> To be honest, I don't completely understand what you are trying to do in the
> left image, the lower part has to have an angle in it?
> I'm not sure that's going to work without skewing of some sort.
>
> regards,
> JC
>
>
> On Tue, Apr 28, 2009 at 1:05 PM, natalia Vikhtinskaya <natavi.m...@gmail.com
>> wrote:
>
>> Yes I could not get correct rusult with masked video using neither
>> your code nor my code.
>>
>> 2009/4/28 Hans Wichman <j.c.wich...@objectpainters.com>:
>> > Hi,
>> >
>> > no don't think so, there is an example in there of a masked clip, and a
>> > sample of video.
>> > I'm assuming you've tried my code with masked video and it didn't work,
>> or
>> > are you asking me to try that for you? I wasn't quite sure;). Because I
>> see
>> > no reason why it wouldn't work :)
>> >
>> > regards,
>> > JC
>> >
>> > On Tue, Apr 28, 2009 at 11:55 AM, natalia Vikhtinskaya <
>> > natavi.m...@gmail.com> wrote:
>> >
>> >> Yes, I saw these excellent examples and learned a lot. But it does not
>> >> help with this situation. Do you have example where you have masked
>> >> video?
>> >>
>> >> 2009/4/28 Hans Wichman <j.c.wich...@objectpainters.com>:
>> >>  > "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
>> >> >
>> >>
>> >> _______________________________________________
>> >> 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
>> >
>>
>> _______________________________________________
>> 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
>

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to