Jump to content
Search Community

Rotation affects scaling producing an error

Pilatus test
Moderator Tag

Recommended Posts

TweenLite.set(dummySprite, {transformAroundCenter: {rotation: dummySprite.rotation + rad2deg(delta.angle),
                                                    scaleX: dummySprite.scaleX*delta.scale,
                                                    scaleY: dummySprite.scaleY*delta.scale}});

When I rotate an object, also its scaling properties are affected and when I apply rotations over and over this effect is accumulated.

See video of the effect (if you still don't see the HD version, wait a bit that google renders it), I just enabled rotation in there, as you can see, scaling is being affected.

 

Essentially the scaling values shrink. I tried multiple ways to counter this effect but without success, how could I do it?

There must be a trick for this. If I just scale with some rotation already existing, the rotation is not affected too much. But when I rotate, scaling is perturbed really bad. Maybe there is something I miss. This is what I tried but it didn't work, banging my head on how to solve this.

 

if(delta.angle != 0 && delta.scale != 0)
	{
	TweenLite.set(dummySprite, {transformAroundCenter: {rotation: dummySprite.rotation + rad2deg(delta.angle),
														scaleX: dummySprite.scaleX*delta.scale,
														scaleY: dummySprite.scaleY*delta.scale}});
	}
else
	{
	if(delta.angle != 0)
		{
		var unperturbedScaleX:Number  = dummySprite.scaleX;
		var unperturbedScaleY:Number  = dummySprite.scaleY;
		TweenLite.set(dummySprite, {transformAroundCenter: {rotation: dummySprite.rotation + rad2deg(delta.angle)}});
		TweenLite.set(dummySprite, {transformAroundCenter: {scaleX: unperturbedScaleX/dummySprite.scaleX, scaleY: unperturbedScaleY/dummySprite.scaleY}});
		}
	else if(delta.scale != 0)
		TweenLite.set(dummySprite, {transformAroundCenter: {scaleX: dummySprite.scaleX*delta.scale, scaleY: dummySprite.scaleY*delta.scale}});
	}

 

Link to comment
Share on other sites

Sorry to hear you are having trouble but its extremely difficult to trouble shoot something like this by looking at some code fragments and a video.

Your sample code seems to be changing the scale:

 

scaleX:dummySprite.scaleY * delta.scale

 

Unfortunately, I have no idea what those values are, when they are being set, how often they are being set, or what I should expect them to do.

 

Best thing to do is provide an extremely simplified FLA with just enough animation code to clearly produce the error. Preferably, just a few tweens. No interactivity or advanced debugging tools. 

We'll gladly give it a peek.

  • Like 1
Link to comment
Share on other sites

Everytime I receive a delta object, I just moved the mouse a little bit, I get a mouse movement notification, calculate the difference in scale and angle, then apply it to the object. it works but scale is perturbed by rotation.

I'll try to build something extremely simple to pin point the problem, but it's not easy because it's part of a big project.

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