DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiEditor::Motion Namespace Reference

Classes

struct  RowHover
 List rows that ImGui draws (tree nodes, selectables) with a fading highlight. More...

Functions

bool ReduceMotion ()
 Reduce motion: every animation lands on its target the frame it is asked for.
void SetReduceMotion (bool reduce)
float To (ImGuiID id, float target, float seconds)
 Move id's value linearly toward target so a full 0 -> 1 sweep takes seconds, and return it.
float ToFrom (ImGuiID id, float from, float target, float seconds)
 Like To, but the first sighting starts at from instead of the target, for things that should animate IN when they first appear (a popup opening, a toast arriving).
float Follow (ImGuiID id, float target, float seconds, float epsilon=0.01f)
 Chase an unbounded value (a scroll position, a zoom level): covers most of the remaining distance within seconds, fast at first and settling (exponential ease-out), and snaps when within epsilon.
void Set (ImGuiID id, float value)
 Jump id to value now, with no animation (e.g.
bool AnyMoving ()
 Whether anything animated this frame is still moving.
float EaseOut (float t)
 Curves: map linear progress t in [0, 1] to eased progress.
float Smooth (float t)
ImVec4 Mix (const ImVec4 &a, const ImVec4 &b, float t)
 Blend two colours by t in [0, 1].
float Hover (ImGuiID id, bool hovered)
 Hover highlight in one call: eased 0 -> 1 while hovered, back to 0 after.
float Progress (ImGuiID id, float fraction)
 A progress bar's fill: glides toward fraction as work reports it in steps, and drops back at once when it goes down (a new run starting at 0).
ImU32 WithAlpha (ImU32 col, float t)
 col with its alpha scaled by t in [0, 1].
float ItemHover (bool hovered)
 For a hand-drawn hover background, right after its item (usually an InvisibleButton): the fade for the item just submitted.
float ItemPress ()
 Press feedback for the same kind of item, also right after it: eased 0 -> 1 while it is held under the pointer, back to 0 after release.
ImU32 PressShade (float t)
float RowHighlight (ImGuiID id, bool selected, bool hovered, float selectedAlpha, float hoveredAlpha, float *outSelected=nullptr)
 A row's highlight strength: the stronger of its selection fade (scaled by selectedAlpha) and its hover fade (by hoveredAlpha).

Variables

constexpr float kFast = 0.10f
constexpr float kNormal = 0.14f
constexpr float kSlow = 0.20f

Function Documentation

◆ ReduceMotion()

bool DekiEditor::Motion::ReduceMotion ( )

Reduce motion: every animation lands on its target the frame it is asked for.

Stored in the editor settings ("editor.reduceMotion"), read once and cached, so the check costs nothing per widget.

◆ SetReduceMotion()

void DekiEditor::Motion::SetReduceMotion ( bool reduce)

◆ To()

float DekiEditor::Motion::To ( ImGuiID id,
float target,
float seconds )

Move id's value linearly toward target so a full 0 -> 1 sweep takes seconds, and return it.

Time-based (the same length at 60 and 144 Hz). A value seen for the first time starts AT its target: a panel that just opened shows its state instead of animating everything in it from zero. Pair with an easing curve below for the shape.

◆ ToFrom()

float DekiEditor::Motion::ToFrom ( ImGuiID id,
float from,
float target,
float seconds )

Like To, but the first sighting starts at from instead of the target, for things that should animate IN when they first appear (a popup opening, a toast arriving).

◆ Follow()

float DekiEditor::Motion::Follow ( ImGuiID id,
float target,
float seconds,
float epsilon = 0.01f )

Chase an unbounded value (a scroll position, a zoom level): covers most of the remaining distance within seconds, fast at first and settling (exponential ease-out), and snaps when within epsilon.

First sighting snaps to the target.

◆ Set()

void DekiEditor::Motion::Set ( ImGuiID id,
float value )

Jump id to value now, with no animation (e.g.

a scroll the user dragged directly, which the follower must not fight).

◆ AnyMoving()

bool DekiEditor::Motion::AnyMoving ( )

Whether anything animated this frame is still moving.

Lets a caller keep redrawing while motion is in flight and rest once it settles.

◆ EaseOut()

float DekiEditor::Motion::EaseOut ( float t)
inline

Curves: map linear progress t in [0, 1] to eased progress.

◆ Smooth()

float DekiEditor::Motion::Smooth ( float t)
inline

◆ Mix()

ImVec4 DekiEditor::Motion::Mix ( const ImVec4 & a,
const ImVec4 & b,
float t )
inline

Blend two colours by t in [0, 1].

◆ Hover()

float DekiEditor::Motion::Hover ( ImGuiID id,
bool hovered )
inline

Hover highlight in one call: eased 0 -> 1 while hovered, back to 0 after.

◆ Progress()

float DekiEditor::Motion::Progress ( ImGuiID id,
float fraction )
inline

A progress bar's fill: glides toward fraction as work reports it in steps, and drops back at once when it goes down (a new run starting at 0).

◆ WithAlpha()

ImU32 DekiEditor::Motion::WithAlpha ( ImU32 col,
float t )
inline

col with its alpha scaled by t in [0, 1].

◆ ItemHover()

float DekiEditor::Motion::ItemHover ( bool hovered)
inline

For a hand-drawn hover background, right after its item (usually an InvisibleButton): the fade for the item just submitted.

Draw the background while this is above 0, with its colour through WithAlpha, and it fades in and out instead of switching.

◆ ItemPress()

float DekiEditor::Motion::ItemPress ( )
inline

Press feedback for the same kind of item, also right after it: eased 0 -> 1 while it is held under the pointer, back to 0 after release.

Draw PressShade over the item's background at this value and it dips while pressed. (Native ImGui buttons get the same through PressMotion, with no call.)

◆ PressShade()

ImU32 DekiEditor::Motion::PressShade ( float t)
inline

◆ RowHighlight()

float DekiEditor::Motion::RowHighlight ( ImGuiID id,
bool selected,
bool hovered,
float selectedAlpha,
float hoveredAlpha,
float * outSelected = nullptr )
inline

A row's highlight strength: the stronger of its selection fade (scaled by selectedAlpha) and its hover fade (by hoveredAlpha).

Draw the row as selected while this is above 0, with the highlight colour at this alpha as both its normal and hovered background. outSelected receives the eased selection fade alone, for anything else that marks selection.

Variable Documentation

◆ kFast

float DekiEditor::Motion::kFast = 0.10f
constexpr

◆ kNormal

float DekiEditor::Motion::kNormal = 0.14f
constexpr

◆ kSlow

float DekiEditor::Motion::kSlow = 0.20f
constexpr