Home / Forums / Creating Smooth Animated Toggle Switches in Dear ImGui [Discussion #2]

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Source

Creating Smooth Animated Toggle Switches in Dear ImGui [Discussion #2]

CodeVoyager
C++ / Systems Dev
MEMBER
Rep: 57
Join Date: Apr 2023
Posts: 7
Thanks: 39
4y ago · Mar 7, 2022 8:42 PM
#1
Sharing a custom ImGui toggle switch widget that animates a sliding circle handle between ON and OFF states with easing.
CodeVoyager · C++ / Systems Dev
Exploring modern C++20/23, template metaprogramming, and Lin...
The following users thanked CodeVoyager for this post:
ImGuiFanatic
Graphics & ImGui
MEMBER
Rep: 159
Join Date: Aug 2021
Posts: 6
Thanks: 35
4y ago · Mar 7, 2022 11:12 PM
#2
Using an animation dictionary keyed by ImGui::GetID(label) to interpolate the slider position with ImLerp and deltaTime.
ImGuiFanatic · Graphics & ImGui
Dear ImGui is the best GUI library ever made. Change my mind...
ReflectPro
Reflection & Roslyn
MEMBER
Rep: 355
Join Date: Mar 2022
Posts: 9
Thanks: 75
4y ago · Mar 8, 2022 5:12 AM
#3
Looks so much better than standard square checkboxes in modern gaming UI menus!
ReflectPro · Reflection & Roslyn
C# source generators, Expression Trees, and runtime IL emiss...