-
Notifications
You must be signed in to change notification settings - Fork 1k
Scaling tween animation issue #7603
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
Comments
For instance, if you take 2 tweens with a
after 2 seconds you would expect both to be at a scale of 2, but with a linear interpolation the 1st one would actually be at a scale of 2.5 = (1 + 4) / 2. This is because, a one-time scaling is a multiplication (not an addition). So, a progressive scaling over time is an exponential. I think the issue is that the For instance, if an easing has a peak of 1.5, with a linear interpolation:
So with a linear interpolation, the easing would be stronger in one way than the other. In your case, since the side effect of using a linear interpolation reduces the easing effect and allow you to get the result you want, you could tween the width and height of the object. These tweens use a linear interpolation because they can be seen as a translation of the object bounds (for instance to animate a life bar). |
Thank you for the explanation, I can't say I fully understand all of it yet, but I will revisit the topic later. I will also try using width and height tweening as suggested. Previously, I developed a mobile game using a different game engine. I really like the concept of GDevelop, so I thought it would be a great learning experience to recreate the game here. However, I encountered this scaling issue right at the intro screen. I've recorded a video showing the difference. Once I replaced exponentialInterpolation with linearInterpolation in the GDevelop source code, the animation behaved exactly like it does in the other game engine, which is the behavior I need. Would it be possible to make the interpolation function configurable in the scale tween action, so we could choose between exponential and linear? Here are the comparison videos: |
Is there an existing issue for this?
Describe the bug
When I add a scale tween animation to an object or group in the event sheet and set the easing parameter to a value like
easeOutBack
, the object or group gets excessively over-scaled during the animation, far beyond the expected range.I investigated the source code and found that in the
addObjectScaleTween3
function, the tween is applied usingexponentialInterpolation
:GDevelop/Extensions/TweenBehavior/tweenruntimebehavior.ts
Line 852 in 3c63f9b
When I replace
exponentialInterpolation
withlinearInterpolation
, the scaling animation behaves as expected.My question, why is
exponentialInterpolation
used instead oflinearInterpolation
inaddObjectScaleTween3
?The same
exponentialInterpolation
is also used in theaddObjectScaleXTween2
andaddObjectScaleYTween2
functions:GDevelop/Extensions/TweenBehavior/tweenruntimebehavior.ts
Line 915 in 3c63f9b
GDevelop/Extensions/TweenBehavior/tweenruntimebehavior.ts
Line 1008 in 3c63f9b
Additionally, there seems to be an unnecessary
_addObjectScaleXTween
call inside theaddObjectScaleTween3
function:GDevelop/Extensions/TweenBehavior/tweenruntimebehavior.ts
Lines 815 to 824 in 3c63f9b
I'd like to understand the design decision before submitting a fix or change. Thanks!
Steps to reproduce
To Scale = 1
andEasing = easeOutBack
During the animation, the sprite scales up excessively beyond the intended size.
GDevelop platform
Desktop
GDevelop version
5.5.230
Platform info
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: