[Solved] How can I ease-in (ramp up) a sprite animation FPS?

I have a sprite with a 2 frame walk-cycle animation.

The animation plays for .1s and loops. I guess that means it plays at 20 fps.

I would like to ease-in this animation so it starts at zero fps and goes up to full speed over the span of 1 second.

Press right key > ramp up animation from 0 fps to 20 fps over 1 second.
Release right key > ramp down animation from 20 fps to 0 fps over 1 second.

How can I achieve this?

There is an action to change the speed scale.
image
I guess you can trigger it every 1/20th of a second to increase the speed scale by 1/20…something like that. :slight_smile:

Thanks. What would I use to trigger the increase? A timer? How would I get the increases to stop happening after 1 second?

Variable tweens.
Start tween increase when move key is pressed (trigger once)
Start tween decrease when move key is released

Thanks, the variable tween looks like it can accomplish what I’m trying to do.

I’m not sure what to put in Tween Identifier or Object Variable though. I am looking to animate the “animation speed scale” from 0-1.

Object variable is the object the tween and the variable are attached to . The object needs to have the tween behaviour added to it.

Tween identifier is the name for you to identify the tween and can be any string you want. You can use that name to check if exists, is in progress, what the progress is, has finished and more.

For example, if your tween identifier is “ChangeAnimationSpeed”, then you could use it in the condition to check if “ChangeAnimationSpeed” is in progress (or exists), and then use the action to set animation speed to the object variable.


I’m still struggling to figure this one out. I’m new to GDevelop. I called the object variable “Speed”, and attempted to change the animation speed scale set to that object variable. It didn’t work so I think I’m missing a step.

Because you refer to a scene variable. But you are looking for the object variable.
Character.Variable(Speed)

I made that change and unfortunately it still doesn’t work. The animation doesn’t play (stuck on first frame of animation).

Maybe the “change animation speed scale” is only getting triggered once at the beginning of pressing right key, instead of updating the animation speed scale in real-time as the tween is happening (from 0-1)

I figured it out by triggering the tween only once.

1 Like