You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to do is when i hover my mouse over a histogram it should change its color but with transition,like fade_in,fade_out something like that how shall i do it?
The text was updated successfully, but these errors were encountered:
It's not easily possible at imgui level but you can do it as user code level. You would need to track hover-state and a timer for each ID you want to involve in the animation (e.g. map<id, float>) and manually update those timers. Say, you could store a 0.0..1.0 float per ID, make this float grow toward 1.0 on hover and go back toward 0.0 otherwise.
Something like this pseudo-code:
(untested, I'm just typing code in the reply here)
ImGuiID item_id = ImGui::GetID("label");
auto it = my_map.find(item_id);
float value = (it != my_map.end()) ? it->second : 0.0f;
PushStyleCol(...., lerp(saturate(value), color, color_hovered);
PlotHistogram();
if (IsItemHovered())
value = min(value + io.DeltaTime * fade_in_speed, 1.0f);
else
value = max(value - io.DeltaTime * fade_in_speed, 0.0f);
if (it != my_map.end())
it->second = value;
else if (value > 0.0f)
my_insert.insert(pair(id, value));
PopStyleCol();
I am trying to do is when i hover my mouse over a histogram it should change its color but with transition,like fade_in,fade_out something like that how shall i do it?
The text was updated successfully, but these errors were encountered: