Jump to content
Search Community

tweening blurFilter loses nested shape blendmode [SOLVED]

michaelangela test
Moderator Tag

Recommended Posts

Hi there,

 

I have a sprite which adds a shape "disk" with a blendmode of multiply. Code below. Adding a blurFilter such as:

TweenMax.to(this, 1, {x:dest.x,y:dest.y,scaleX:scale, scaleY:scale,autoAlpha:0.35, blurFilter:{blurX:5, blurY:5}, ease:Strong.easeOut});

causes the disk to lose it's blendMode. If I then do a tween such as:

TweenMax.to(this, 1, {x:dest.x,y:dest.y,scaleX:scale, scaleY:scale,autoAlpha:0.35, blurFilter:{blurX:0, blurY:0,remove:true}, ease:Strong.easeOut});

the blendMode comes back when the tween is complete.

 

Is there any way to keep the blendMode while tweening with a blurFilter? And add to that, would this also be an issue with a dropShadowFilter?

 

Thanks!

 

Michael

 

disk = new Shape();
disk.graphics.beginFill( 0x373535 );
disk.graphics.drawCircle(_SIZE/2,_SIZE/2,_SIZE/2);
disk.graphics.endFill();
disk.blendMode = BlendMode.MULTIPLY;
addChild( disk );
tf = new TextField();
tf.autoSize = TextFieldAutoSize.LEFT;
tf.multiline = true;
tf.wordWrap = true;
tf.width = _SIZE;
tf.text = "some test text";
tf.embedFonts = true;
tf.setTextFormat( textFormat );
tf.y = 0.5 * (_SIZE - tf.height);
tf.mouseEnabled = false;
addChild( tf );

Link to comment
Share on other sites

There must be something else going on in your file - I just tested it and the blendMode worked fine for me while doing a BlurFilter tween. Could you post an FLA that demonstrates the issue (the simpler the better please). Don't forget to zip your file before posting.

Link to comment
Share on other sites

Hi Jack,

 

I am still trying to track it down but hopefully this example will help. It's only visible when the color behind the tweened object is not white.

 

The swf size and color is being set by the SWF metadata tag in the BlurFilterTest.as class as well as all the releveant code.

 

After a delay of 1 second the tween starts, delays another second, and then reverses. You can see the red disk "pop" a bit as it goes through the tween.

 

I hope this example makes sense. And thank you for looking at it! I see that what I am trying to do can in fact be done in the Flash IDE by setting filters, etc., so it must be something about how I am combining things. I just haven't been able to find where the issue is so far.

 

Michael

Link to comment
Share on other sites

I see that what I am trying to do can in fact be done in the Flash IDE by setting filters, etc., so it must be something about how I am combining things. I just haven't been able to find where the issue is so far.

 

Actually, I don't think that's the case - the problem (as far as I can tell) is that you're doing the blendModes in children of your container, and then you're applying a filter to the container itself. Whenever you apply a filter to an object, Flash forces its cacheAsBitmap property to true which is kinda like taking a bitmap screen capture of that object and using that when rendering it on the stage. So it kinda makes sense that you couldn't have different portions of the screen capture with different blend modes than other portions. Think of it like a BitmapData object where you're expecting Flash to have 100 pixels multiply with the layers below while 80 other pixels blend normally, etc.

 

See what I mean?

 

This has nothing to do with TweenLite/Max - it's just a Flash thing.

 

I tried recreating what you're trying to do in the IDE and it wouldn't do it either (children with various blendModes while the container has a filter applied).

Link to comment
Share on other sites

Yeah that totally makes sense. i'll try putting the filters on the individual elements instead of the container and just tween the container alpha.

 

Thank you very much for the followup and helping me figure out where it was failing!

 

[edit] Yep that did it. The container only gets the non-filter tweens and the individual elements within get the filters as needed. Works a treat! Thanks again.

 

Michael

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...