Jump to content
Search Community

multiple filters [SOLVED]

stepi test
Moderator Tag

Recommended Posts

Hi,

 

I'm trying to create a tween where there are two glow filters. I know this is possible in AS3 but how do I do it in TweenMax? I've tried disabling overwrite with 2 tweens that are played at the same time. But it's not working since I can only see one glow filter applied.

 

I have these tweens:

 

_tween = new TweenMax(targetFrom, 0.2, {
                   glowFilter: {color: 0xffffff, alpha: 1, blurX: 100, blurY: 100, strength: 2.5, quality:1},    
                   ease: Linear.easeIn,
                   delay:0.05,
                   paused: true,
                   overwrite:0
               }
           );

_tween2 = new TweenMax(targetFrom, 0.2, {
                   glowFilter: {color: 0x5EC5F7, alpha: 1, blurX: 100, blurY: 100, strength: 2, quality: 1},
                   ease: Linear.easeIn,                    
                   paused: true,
                   delay:0.05,
                   overwrite:0
               }
           );

 

 

and then there's

 

_tween.play();

_tween2.play();

 

Thank you!

Link to comment
Share on other sites

That's what the "index" property is for in any filter tween - it allows you to target a certain index in the DisplayObect's filters array. So your code would look like:

 

_tween = new TweenMax(targetFrom, 0.2, {
                       glowFilter: {index:1, color: 0xffffff, alpha: 1, blurX: 100, blurY: 100, strength: 2.5, quality:1},   
                       ease: Linear.easeIn,
                       delay:0.05,
                       paused: true,
                       overwrite:0
                   }
               );

_tween2 = new TweenMax(targetFrom, 0.2, {
                       glowFilter: {index:0, color: 0x5EC5F7, alpha: 1, blurX: 100, blurY: 100, strength: 2, quality: 1},
                       ease: Linear.easeIn,                   
                       paused: true,
                       delay:0.05,
                       overwrite:0
                   }
               );

 

Just be careful with the timing because if your object doesn't have any filters to start and you run the tween that targets index:1 first, that means the filters array would have an empty slot at the 0 position and Flash will thrown an error. Also keep in mind that in order for overwriting to function properly, tweens that are created later actually run first which is why I have index:1 above index:0 in the code.

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...