Jump to content
GreenSock

mrEmpty

BlitMask BitmapMode

Recommended Posts

Hello.

 

BlitMask is the bomb! Wow! I'm still not getting more than 11fps on my Galaxy tablet I've been given for testing, but on a PC system, woah! Woosh.

 

Anyway, I'm using BitmapMode to keep things fast. I have noticed that is I wish to use wrap, I cannot disable bitmap mode? Is this correct? It seems to be that the original items need to be visible on stage at the end of a tween to be able to interact with them, hence the disabling the bitmap mode. That makes sense I guess, but I wanted to clarify that?

 

For example, if I had three stage size movie clips on the stage, they are children of another movie clip which is the target for the blitmask. These movie clips have simple interaction in them, lets say a little round sprite that grows if you mouse over. I want those three movie clips to tween left and wrap, or right, or both, but the wrap is important. Blitmask does this for me (thanks Mr. Greensock, the purchase was worth it to support this alone) but onComplete:disableBitmapMode will then kill the wrap, and the clips may be way off stage at this point.

 

See the issue?

 

Any way around it?

 

I have read the documentation :) And I have a sample FLA I can post.

Link to comment
Share on other sites

I've got good news for you: I just uploaded a new version of BlitMask that adds this feature via a new normalizePosition() method which automatically gets called when you disable bitmapMode while "wrap" is true. This should make things pretty seamless for you (you probably don't even need to call that method since it automatically happens when you toggle bitmapMode). Just download the latest version from the public site (https://www.greensock.com/account/

 

Let me know if that works well for you.

Link to comment
Share on other sites

No!

 

Go to the pub on a Saturday night or try new Greensock features... hmmm.

 

:)

Link to comment
Share on other sites

Hmm, ok, not sure if I'm doing this correctly but I'm getting odd results.

 

I have this target movie clip:

 

public var master:MovieClip = new MovieClip();

 

Into which I shove some Sprites:

 

private function setupMain(event:LoaderEvent):void
	{
		var panels:XMLList = event.target.content.panel;

		for (var i:int = 0; i < panels.length(); i++)
		{
			var box:GSquare = new GSquare();
			box.rotation = 90;
			box.x = (box.width - 2) * (i+1);
			master.addChild(box);
			trace(box.x);
		}		
		confMaster();
	}

 

I then configure that master movie clip along with my blit mask:

 

private function confMaster():void
	{
		addChild(master);
		master.y = 100;
		master.x = 100;

		bMask = new BlitMask(master, master.x, master.y, master.width, master.height, true, false, 0, true);
		bMask.bitmapMode = false;
	}

 

Then I run a tween:

 

private function testBlit(event:MouseEvent):void
	{
		TweenMax.to(master, 1, {x:master.x - 160, onUpdate:bMask.update, onStart:bMask.enableBitmapMode, onComplete:bMask.normalizePosition, onComplete:bMask.disableBitmapMode});
	}

 

Once the tween ends, I have no ability to interact with my nested sprites (I do before calling that tween). But also each time that tween runs the master movie clip moves up (down) 1 pixel. I traced out the position of everything and only the master movie clip is moving.

 

I'm not sure if normalisePosition() is working due to the other things. :)

Link to comment
Share on other sites

You can't have two onCompletes in your tween :) That'd be kinda like doing this:

 

myObj.onComplete = function1;
myObj.onComplete = function2;

 

See what I mean? It's either one or the other. Your tween should look like:

 

TweenMax.to(master, 1, {x:master.x - 160, onUpdate:bMask.update, onStart:bMask.enableBitmapMode, onComplete:bMask.disableBitmapMode});

 

You're saying that after that tween finishes, it is acting like it is still in bitmapMode? What specifically are the symptoms? Do things still wrap? Can you post a very simple FLA that we can publish to see what's going on?

Link to comment
Share on other sites

Here's an FLA :)

 

Second onComplete removed, interaction came back :oops:

 

Each tween moves the movie clip vertically by one pixel. Also, I guess I don't understand normalise, but the items only return to the first state after all of them have been off the edge of the mask.

 

Thanks for your help :)

Link to comment
Share on other sites

I couldn't compile the project because of missing classes. I know for sure that the "com.fingerpuk.ui.Triangle" class is missing. Could you provide a full set of files that can be compiled? No need to post the GreenSock classes, though - just the other stuff. The simpler the better.

Link to comment
Share on other sites

There were several problems, one of which had to do with BlitMask (which is fixed now). I have attached a revised document class that has the fixes in place along with some comments that should explain them. Please make sure you download the latest version of BlitMask too in order to see everything working.

 

Keep in mind that the "wrap" feature only works when bitmapMode is on, but when you turn it off BlitMask will automatically reposition your target so that the largest portion of it is showing. So, for example, let's say you scroll to where a seam is showing, like the right 60% and the left 40%. In that case, when bitmapMode is turned off, it will position the target so that you see the 60% of the right side. It would be impossible for BlitMask to actually duplicate your raw DisplayObject with all of its interactivity, etc. and split it that way. See what I mean? The reason the wrap feature works in bitmapMode is because it is simply copying the pixels to appear as though it is wrapped, but there's still only one target.

 

I hope that helps.

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