Skip to content

Immediate Mode animation extension for Dear ImGui.

License

Notifications You must be signed in to change notification settings

RaidcoreGG/ImAnimate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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
};

Languages