> For the complete documentation index, see [llms.txt](https://alexxander.gitbook.io/tweenplus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alexxander.gitbook.io/tweenplus/creation/custom-easing-functions.md).

# Custom easing functions

Instead of moving from 0 to 1 at a constant rate (linear), an easing function remaps time so the speed of the motion changes over the course of the animation.

Usually, easing styles have 4 "directions":

* **In**: slow → fast
* **Out**: fast → slow
* **In-Out**: slow → fast → slow
* **Out-In:** fast → slow → fast

Easing is crucial in animations to make them feel natural, rather than robotic. These functions can be visualized with graphs, showing the motion from A to B. You can check out interactive examples at [easings.net](https://easings.net/).

***

To add your own easing functions alongside the built-in ones, simply create a new module in your game, then [tag](https://create.roblox.com/docs/studio/properties#instance-tags) it `EasingFunctions`.

Here’s the required format:

```luau
-- You can add any code here obviously :D

return {
	-- You can either write a single direction style:
	CoolEasing = function(alpha)
		return alpha
	end,
	
	-- Or you can write an all directions style:
	SuperCoolEasing = {
		In = function(alpha)
			return alpha
		end,
		Out = function(alpha)
			return alpha
		end,
		InOut = function(alpha)
			return alpha
		end,
		OutIn = function(alpha)
			return alpha
		end
	}
}
```

{% hint style="success" %}
Tween+ will let you know if you do anything wrong!
{% endhint %}

{% hint style="info" %}
You can always look in `Tween->Utilities->EasingFunctions` to see how the built-in ones are made. Just keep in mind they’re ultra-optimized.
{% endhint %}
