Skip to content

Latest commit

 

History

History
66 lines (53 loc) · 1.2 KB

README.md

File metadata and controls

66 lines (53 loc) · 1.2 KB

ImAnimate

Immediate Mode animation extension for Dear ImGui.

You don't need to track any current value, animation start or state.
You just provide your start and end values, as well as the duration in milliseconds and your curve.

Usage

Function Signature

void Animate(float aStartValue, float aEndValue, float aDurationMs, float* aValue, ECurve aCurve = ECurve::Linear);

Example: Hover Animation

hover_animation_example
The animation above is generated by the following code.

static float imgSize = 1.0f;
ImGui::Image(icon, ImVec2(imgSize, imgSize));
if (ImGui::IsItemHovered)
{
	ImGui::Animate(1.0f, 1.1f, 500, &imgSize, ECurve::InCubic);
}
else
{
	ImGui::Animate(1.1f, 1.0, 500, &imgSize, ECurve::OutCubic);
}

Easing functions

The following easing functions are currently implemented.

enum class ECurve
{
	Linear,

	InSine,
	OutSine,
	InOutSine,

	InQuad,
	OutQuad,
	InOutQuad,

	InCubic,
	OutCubic,
	InOutCubic,

	InQuart,
	OutQuart,
	InOutQuart,

	InQuint,
	OutQuint,
	InOutQuint,

	InExpo,
	OutExpo,
	InOutExpo,

	InCirc,
	OutCirc,
	InOutCirc
};