Jump to content
Search Community

How to tween scaleX Y rotationX Y at the same time?

jasminej test
Moderator Tag

Recommended Posts

How to tween when target needs set scaleX, scaleY, transform.perspectiveProjection, and rotationX, rotationY at the same time?

 

Why the below tween is not working? I only want to set the rotationY from 0 to -90, but scaleX, scaleY, rotationX should keep the same before tween and during the tween.

 

matrix1 = mc1.transform.matrix;

matrix1.a = .5;

matrix1.d = .5;

mc1.rotationX = -20;

mc1.rotationY = 0;

mc1.transform.matrix = matrix1;

 

TweenMax.to(mc1, 2,

{rotationY:-90,

rotationX:-20,

transformMatrix:matrix1});

Link to comment
Share on other sites

Thanks for the response.

 

The sample code uses Matrix3D for scaleX and scaleY, but I dunno how to add rotationX rotationY and perspective. Any one can help? Thanks in advacne!

 

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;

}

Link to comment
Share on other sites

Is there some reason you're not doing it in the straightforward manner?:

TweenMax.to(mc, 2, {scaleX:0.5, scaleY:0.5, rotationY:0, rotationX:-20});

 

Because the mc has already set scaleX Y rotationX with perspective before tween. I hope tween keeps the same scaleX Y rotationX perspective, but only set rotationY to flip from from mc center.

 

I tried TweenProxy3D, its working well without set rotationX. That's why I'm thinking to use the transformMatrix.

Link to comment
Share on other sites

I read your response a few times and I'm still not sure what you meant or how to respond. Maybe you're trying to tween things using a custom registration point? If so, yes, TweenProxy3D is the best for that.

 

Sorry, I didn't say it clearly. I mean if I only wanna change rotationY, but keep the other properties the same value. The tween doesn't work correctly, it starts from scaleX Y equal 1.

 

mc.scaleX = .5,

mc.scaleY = .5;

mc.rotationX = -20;

TweenMax.to(mc, 2, {scaleX:.5, scaleY:.5, rotationX:-20, rotationY:-90});

Link to comment
Share on other sites

I'm confused - you're saying that you believe TweenMax alters the scaleX/scaleY even when you don't want it to? So if, for example, scaleX/scaleY are 0.5 and then you do a TweenMax.to() for rotationY, scaleX/scaleY will jump to 1 inadvertently?

 

Yeah, it will start to 1. Please check the attached simple file. Maybe I missed something, I'm not sure..

Link to comment
Share on other sites

I'm still super confused - I tested your FLA and added an onUpdate to the tween to trace() the scaleX/scaleY constantly and it was always 0.5 as expected. Everything looked like what I'd expected. Why do you think those values are starting at 1? I must be missing something.

Link to comment
Share on other sites

I'm still super confused - I tested your FLA and added an onUpdate to the tween to trace() the scaleX/scaleY constantly and it was always 0.5 as expected. Everything looked like what I'd expected. Why do you think those values are starting at 1? I must be missing something.

 

I tried that too, trace 0.5 is correct. But if u open the swf file, click the test button, it animated from 1 to 0.5.

Link to comment
Share on other sites

I downloaded the file, added an onUpdate like greensock suggested and did not see or trace the scaleX/Y at anything other than .5.

 

package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;

import com.greensock.TweenMax;

public class demo2 extends MovieClip
{		
	public function demo2()
	{

		btn.addEventListener(MouseEvent.CLICK, onClickBtn);

		mc1.gotoAndStop(0);

		mc1.scaleX = .5;
		mc1.scaleY = .5;
		mc1.rotationX = -20;
	}

	private function onClickBtn(event:MouseEvent):void 
	{
		TweenMax.to(mc1, 2, 
		{
			rotationY:-90,
			scaleX:.5,
			scaleY:.5,
			rotationX:-20
			, onUpdate:getScale});
	}

	function getScale(){
		trace(mc1.scaleX + " : " +  mc1.scaleY);


		}

}
}

 

I can not reproduce seeing that scaleX/Y being set to 1 at any time.

Link to comment
Share on other sites

I tried testing the swf many times from Flash Pro and in the stand alone player. I could not replicate what you have in your video.

 

very, very strange. I attached my swf just so that you can see if a swf compiled somewhere else performs any differently although I don't understand why that would be or why you are getting that odd behavior.

 

thank you for posting the video.

Link to comment
Share on other sites

I tried testing the swf many times from Flash Pro and in the stand alone player. I could not replicate what you have in your video.

 

very, very strange. I attached my swf just so that you can see if a swf compiled somewhere else performs any differently although I don't understand why that would be or why you are getting that odd behavior.

 

thank you for posting the video.

 

I tried the swf you posted, same odd behavior. I dunno its my Flash CS problem or Flash Player problem.

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