Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
danno

Applying TweenMax to part of stage?

Recommended Posts

I'm wondering if there's a way to apply TweenMax Saturation to only part of an image, or to the non-masked portion of a MC on the stage.

I've attached an example of what i'm talking about. The stage is white, with an image of a cloud in it's own MC. There is a 'masked' ( or non-masked , depending on how you look at it ) that is in color while the remaining parts of the cloudMC is being affected by the TweenMax saturation change.

 

Any help or direction on this would be extremely appreciated.

 

Thank you so much!!

Link to comment
Share on other sites

There's not a super-easy way, but you do have a few options:

 

1) draw() that part of the stage to a BitmapData object, and place it into a Bitmap object that's sitting over the top of the desaturated object.

 

2) Duplicate your object and use the scrollRect property to make only a portion of it visible. Apply the saturation effect(s) accordingly.

 

Hope that helps.

Link to comment
Share on other sites

What I might try is creating two separate image files (same file) layered on top of each other. One with no saturation(bottom) and the other full color(top). Then mask the top item and animate it (the mask that is). This will produce the effect. However, whether it be the ideal method is up for debate.

Link to comment
Share on other sites

Just so you know, scrollRect performs much faster than a mask.

Link to comment
Share on other sites

thanks for the responses guys.

 

the cloudMC in the example above will be a TransformItem , using greensock's TransformManager class. which of the proposed solutions would be appropriate for when the TransformItem is being clicked and dragged around?

 

Thanks again, i really do appreciate it!

Link to comment
Share on other sites

Try the scrollRect first.

 

Indeed, but also to note, scrollRect only allows for a 4 sided shape with 90 degree angles. So if every you needed a different shape, you would need to use a mask... for whatever that's worth.

Link to comment
Share on other sites

Try the scrollRect first.

 

Indeed, but also to note, scrollRect only allows for a 4 sided shape with 90 degree angles. So if every you needed a different shape, you would need to use a mask... for whatever that's worth.

 

I'll give scrollRect a shot first then.

 

Thanks for the heads up about the restrictions. Thankfully, the shape is a square, like the attached example above.

 

I'll let ya know how it goes after i get back from lunch.

Link to comment
Share on other sites

ok so a quick question. i've got the cloudMC on the stage, i've assigned it to a TransformManager and to added it as a new TransformItem.

 

if i'm to duplicate this MC so that one can have a scrollRect applied to it to sit on top of the TransformItem, should i duplicate the contents inside of the cloudMC or create a cloudMC_color and cloudMC_notColor.

 

i hope i'm making sense, thanks!

Link to comment
Share on other sites

  • 2 weeks later...

so after trying and trying i just can't figure out how to do this correctly.

any additional help would be truly appreciated.

 

thanks so much guys!!

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