Gaminics Game Dev Tips #1: Animation Curves

Gaminics Game Dev Tips #1: Animation Curves

When it comes to animating objects when making games, there is always room for some improvement. There are some important points that especially new devs commonly skip. One of these points are Animation Curves.

Animation Curves are the tools to define how will out animations run from start to end. We use them to give our animation a decent, natural look.

No alt text provided for this image
A cube appearing with different Animation Curves

Here is an example of how can we use them.

Basically we are changing a cubes scale from 0 to 1 in a second. But if you notice, the animations are different

The reason for that is, we've made different animation curves to define this animation's "behavior". So the animations run differently.


No alt text provided for this image
Editing an Animation Curve

We can create an AnimationCurve field in our code and open it in the inspector to edit.

There are also predefined curves in the bottom bar. They may be the right fit to some suitable situations.




So how can we use them in our code?

No alt text provided for this image
Usage of SetEase method in DOTween (Tweening Library)

Almost all tweening libraries have a method to change a tweens "Ease".

Ease is basically a function to define that curve. There are tons of ease functions out there.


No alt text provided for this image
Some of the most used easing functions

You can take a look at the different easing methods.

Most of the tweening libraries predefined them so you don't have to create them again in the inspector.

One of the most common use case of animations is jumping objects around. But when you do this, you want to do it the right way.

No alt text provided for this image
Jumping cubes with default (left) and linear (right) ease

If you look at the example, you'll see two jumping cubes. One of them is using DOTweens default easing and the other one's ease is set to Linear.



The default easing is awkwardly slowing down the cube on descend and giving it an unnatural look. We use the "SetEase" method to fix this. Linear easing gives the best results on Jumping objects a most of the cases.

If you think this is helpful, please don't hesitate to share and stay tuned for more content like this.

Gaminics? 2023

要查看或添加评论,请登录

社区洞察

其他会员也浏览了