Jump to content
Search Community

adding animated children to blitmasks

boy2k test
Moderator Tag

Recommended Posts

Hi greensock,

 

Firstly what an amazing set of tools you have on offer :) loving tweenmax and timelinemax!

 

I am trying to impliment blitMask into an animated masking class i have and im having a little difficulty...

 

In my class i am adding shapes as children and using timeline max to animate them. I would like to replace the current mask with a blitmask but when i do this the masking doesnt work. The animation works but not as a mask.

 

I can send code as a PM but i can't post it online im afraid.

 

Would you be able to help?

Link to comment
Share on other sites

Hi and Welcome to the GreenSock forums,

 

It would be best if you could first isolate the problem in a very simple file that doesn't rely on any of your production code or custom masking class. If we can reproduce the issue in a very basic implementation, we will be able to solve the problem much quicker.

 

If that's not possible, you can PM me.

 

One thing I would suggest first is to chuck in a few traces to verify that your BlitMask is being applied properly:

 

trace(BlitMaskInstance.target); //should not be null or undefined
trace(BlitMaskInstance.bitmapMode); //should be false

 

Also make sure bitmapMode is false

 

BlitMaskInstance.bitmapMode = false;

Link to comment
Share on other sites

Hi I took a look at your file.

 

I think you might be misunderstanding the capabilities of BlitMask.

First, I want to illustrate that BlitMask is working in your file.

Do this:

 

on line 133 change the code to this:

 

blitMask = new BlitMask(image, image.x, image.y, 200, image.height, true, true); //notice the custom width

 

Add this right after the trace on 195:

TweenLite.to(blitMask, 5, {scrollX:.5});

 

Test the example.

 

You will see a small rectangle that reveals your source image and that source image scrolls inside the masked area.

 

BlitMask simply allows you to define a rectangle that will be used to either:

  • display only the pixels necessary that were sampled out of a much larger bitmap (this is where the performance gains of blitMask's "blitting" take place)
  • define a rectangular mask that only reveals a portion of a larger image like a traditional Flash mask would work. In this mode, no blitting is taking place, there are no performance gains BUT it allows you to enable interactive content in the BlitMask's target displayObject

I think you are expecting child objects (your dynamically generated sprites) of the BlitMask to also act as individual masks, or define the masked area as something other than a single rectangle. I see you were trying to do a blitMask.addChild(). Unfortunately this is going to have no effect on the masking region.

 

The mask region of a BlitMask, whether bitmapMode is on or not, can only be a solid rectangle.

 

I think you have some awesome effects packed into your custom class, but from what I understand of what you are trying to accomplish I don't see any huge gains (in this application) for using a BlitMask over a regular "someClip.mask = otherClip"

 

Hope this helps clear up the issue.

  • Like 1
Link to comment
Share on other sites

Ahh i see, seems i had my wires crossed with blitmask then.

I will revert to normal masking then for this task.

 

I have another task on my list which needs me to animate across a long room background so it sounds perfect for that task! :mrgreen:

 

Onwards and upwards hehe, thanks again Carl

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