Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScaleX, ScaleY, ScaleZ don't work independently in parallel on the same transform #10

Open
kkjamie opened this issue Nov 9, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@kkjamie
Copy link
Contributor

kkjamie commented Nov 9, 2018

Problem

If we do the following:

tween = new ParalleledAnimation()
    .ScaleX(transform, 0.5f, 2f)
    .ScaleY(transform, 2f, 1f);

We expect that x will scale 0.5f up to 2 whilst y will scale down 2f to 1f.

However the X will be ignored. Or rather which ever one is updated last on the frame will be respected.

The reason behind this is the extensions for Scaling individual axes (X,Y,Z) are just helpers around the ScaleAnimation. The ScaleAnimation tweens between 2 Vector3 values from and to

In other words ScaleX(0.5f, 2f) is essentially just a short hand for:

new ScaleAnimation(
    from: new Vector3(0.5f, currentY, currentZ), 
    to: new Vector3(2f, currentY, currentZ),

The result being that it forces the Y, Z values to remain "locked" to their initial values, whilst tweening X.
So if another tween (or indeed any other logic) is trying to manipulate Y, Z, it will fail to do so (unless it's updated after the tween).

Possible Solutions

  • Make dedicated animations for ScaleX, ScaleY, ScaleZ
  • Implementation change to ScaleAnimation. 3 bool flags to control which of the Vector3 components we should overwrite. They would be optional and default to true (to keep the same behaviour) but we set them in the ScaleX, ScaleY, ScaleZ extensions.

I tend to prefer the second, but I'm open to suggestions

@kkjamie kkjamie added the bug Something isn't working label Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant