Hi, I was wondering if there is a way to scale a certain axis. I just learned you cannot rotate on the x and y axis so I tried faking it with scale. However, it seems you can only scale with a float. Is there going to be a way to scale the x or y? Thanks!
You can apply a Vector3 scale using the transform property: Code (CSharp): element.transform.scale = new Vector3(0.5f, 0.5f, 1.0f); It's a good idea to leave the Z scaling at 1 to avoid issues.
That is what I do initially, but I need to animate it back to that scale. However, I can only animate it as a single float, not the x or y. I want to set it to Vector3(1, 0, 0) which I can do. Animate it too Vector3.One which I assume works with just animating the scale to 1. Animate it back to Vector3(1, 0, 0) which I cannot do as it takes a single value Thanks!
Ah, you are correct. The Vector3 version of the Scale animation isn't yet exposed. We will fix that. Thanks for reporting. As a workaround, you can trigger the animation manually using animation.Start() directly: Code (CSharp): var scaleTo = new Vector3(3,2,1); var durationMs = 2000; element.experimental.animation.Start((e) => e.transform.scale, scaleTo, durationMs, (e, v) => { e.transform.scale = v; });
Hey! Just downloaded the Beta 1 and this still hasn't been exposed. Just curious about a timeline? Thanks!
The bad news is that this missing API is still in our backlog, I don't have an ETA for when it will land in Unity. The good news is that 2021.2 now provides USS transitions which may be a better way to handle non-uniform scaling: https://forum.unity.com/threads/c-2021-2-0a20-how-to-use-transition-properties.1123501/
Ah, I did see that, but I wanted to animate this bit through code. I didn’t want to create a class in uss and add/remove it. Is there a way to animate via transitions through code? I couldn’t find any examples. EDIT: I also asked this question in the thread you posted so it has more visibility for others. Thanks!