Jump to content
Search Community

transformMatrix3D Plugin

bas test
Moderator Tag

Recommended Posts

hi,

 

i need to tween the scale of an image, which simple to do via the scaleX/Y properties. However due to performance (iOS) i wish to examine using the transform.matrix3D which enables the gpu. The transformMatrix works as expected yet just not hardware accelerated.

 

TweenMax.to(imgInstance, 0.3, {transformMatrix:{scaleX:scale, scaleY:scale}});

unfortunately i cannot find much on tweening 3Dmatrix properties. How would you do it?

 

I did found reference to QuaternationPlugin but documentation on that subject is scarse and I am unsure on how to proceed with that (is it even possible to scale, with that?)

 

Would it be difficult to add such a plugin by modifying a copy of transformMatrixPlugin?

TweenMax.to(imgInstance, 0.3, {transformMatrix3D:{scaleX:scale, scaleY:scale}});

 

any insight/hint/code would be very much appreciated, thanks

  • Like 1
Link to comment
Share on other sites

QuaternionPlugin won't really help you in this situation, no. That's a completely different beast.

 

There isn't a transformMatrix3D plugin at this point, but keep in mind that TweenLite/Max can tween ANY numeric property of ANY object, so you can manually tween a Matrix3D and apply it using an onUpdate.

 

TweenPlugin.activate([EndVectorPlugin]);

mc.z = mc.z; //ensures that the transform.matrix3D isn't null (not sure this is an issue for you)
var m3D:Matrix3D = mc.transform.matrix3D;
var v3D:Vector. = m3D.rawData;
var endVector:Vector. = v3D.slice();
endVector[0] = 2; //scaleX - in this case we're making it 2
endVector[5] = 3; //scaleY - in this case we're making it 3;
TweenMax.to(v3D, 3, {endVector:endVector, onUpdate:apply3D});
function apply3D():void {
mc.transform.matrix3D.rawData = v3D;
}

 

You can read up on the Matrix3D here: http://help.adobe.com/en_US/FlashPlatfo ... rix3D.html

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Jack, in response to your proposed work-around, attempting to, on the other hand, tween rotation (say, along the Z axis) by updating individual numeric values of a 3d matrix yields entirely unexpected results. Can you picture what I mean? I realize that bas was interested in animating the scale, not the angle, and I didn’t mean to hijack the thread. I feel, however, that my issue is tightly related.

Edited by IllusionSector
Link to comment
Share on other sites

Could you explain a little more about the "entirely unexpected results" that you're experiencing? How are you editing the values? Which parts of the matrix3D vector are you altering? Any chance you could post a very simple FLA that demonstrates the issue? This doesn't really seem like a TweenLite/Max problem as much as just the mechanics of Adobe's matrix3D, right?

Link to comment
Share on other sites

  • 1 year later...

Bump from the dead. I am having similar issues with my 3D object. I can rotate it with Matrix3D by doing this:

matrix3D.appendRotation(15,Vector3D.X_AXIS);
matrix3D.appendRotation(30,Vector3D.Y_AXIS);
matrix3D.appendRotation(45,Vector3D.Z_AXIS);
But I'm not sure how exactly to tween those 3D rotations instead. I tried messing with my matrix3D.rawData, but it seems only the scale values work as expected. If I change any of the other values, my object gets extremely skewed in weird directions.
 
Edit: It seems working with the rawData is not very intuitive. This is what my trace(matrix3D.rawData) looks like before applying any rotations:
1,0,0,0,
0,1,0,0,
0,0,1,0,
320,180,200,1
 
And then after doing this matrix3D.appendRotation(15,Vector3D.Z_AXIS);
0.9659258127212524,0.258819043636322,0,0,
-0.258819043636322,0.9659258127212524,0,0,
0,0,1,0,
262.5088195800781,256.6887512207031,200,1

I suppose I could find the correct matrix3D.rawData beforehand, and then tween every element to match it? Still, I was hoping there was an easier way.

 

Edit#2: I did just that and it sort of works. My object rotates from the original position to the correct rotation, but along the way it gets squished and scales and translates oddly before it gets there.

Link to comment
Share on other sites

Could you explain a little more about the "entirely unexpected results" that you're experiencing? How are you editing the values? Which parts of the matrix3D vector are you altering? Any chance you could post a very simple FLA that demonstrates the issue? This doesn't really seem like a TweenLite/Max problem as much as just the mechanics of Adobe's matrix3D, right?

[off]Jack, this bump presented me with a reminder/opportunity to apologize to you for not elaborating back then, especially after your prompt reply and attention. I remember getting lost in trying to put together an example to demonstrate the issue, then life got in the way, yada, yada, yada. So, yeah. Sorry about that, man. :oops: [/off]

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