Jump to content
Search Community

Scaling a Bitmap via TransformMatrix won't work

LilaQ test
Moderator Tag

Recommended Posts

Hey greensock,

 

I was just trying to scale a Bitmap with a TranformMatrix (since it's the only way I can think of to scale a Bitmap from the center point)

 

My code is something like this:

 

TweenMax.to(myBitmap, 4, {transformMatrix{a:2}})

 

But it errors that "transformMatrix is not a property of Bitmap and there is no default value" - even if I assign an new Matrix to my Bitmap via myBitmap.tranform.matrix = new Matrix();

 

Is there any way to accomplish what I am trying to do? I need this as a Bitmap, since it uses too much cpu power if I tween it as a MovieClip or something else.

A container isn't possible, too, because it would crop off the bitmap when I place it on a negative x-value.

 

I hope you can help me out.

 

Thanks in advance :)

 

Greets,

Jan

Link to comment
Share on other sites

Ok, that was a quite obvious mistake - thanks :)

 

Additional question - How can i set the center point of the Bitmap to its real center (for any kind of transformations)? Since the "container" method won't work.

 

Thanks in advance :)

 

LilaQ

Link to comment
Share on other sites

The TransformAroundCenterPlugin makes that super simple. It's only for Club GreenSock members, though ("Really Green" and higher). http://www.TweenLite.com. Or you could just put your Bitmap into a container Sprite and offset its x/y coordinates so that the Sprite's registration point is located directly in the center of the Bitmap and then just tween the Sprite.

Link to comment
Share on other sites

I'd be in the club for months if I weren't a poor german scholar : /

 

The Sprite method worked quite well, but how does the performance differ between Bitmap-Only and Bitmap-in-Sprite operations?

 

Thanks for all your help :)

 

Greets

Jan

Link to comment
Share on other sites

It's highly doubtful that you'd ever notice any difference in terms of performance unless you're doing hundreds or thousands of them at the same time. You can also improve performance by setting the container's mouseEnabled property to false. Not really a big deal in most situations, though.

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