RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
Loading...
Searching...
No Matches
rmgui_element_sway_t Struct Reference

One element's drag sway: while the host drags it, the element leans in the direction the pointer moves, as far as its horizontal speed (up to a full lean at 1000 logical px/s), and springs back upright when the pointer rests 50 ms or the drag ends; an impulse rings it, dragged or not. More...

#include <element_motion.h>

Data Fields

rmgui_motion_spring_t lean
int32_t travel_px
uint32_t sample_ms
uint32_t idle_ms
uint8_t dragging

Detailed Description

One element's drag sway: while the host drags it, the element leans in the direction the pointer moves, as far as its horizontal speed (up to a full lean at 1000 logical px/s), and springs back upright when the pointer rests 50 ms or the drag ends; an impulse rings it, dragged or not.

The lean is a damped spring on the style's spring constants; the host scales it to its own largest angle when it reads the rotation, so one state serves any angle. Speed is sampled over the clock time the host steps between moves, so the sway is a pure integer function of (style, moves, impulses, dt sequence), like the motion above. Members are private: the host reads and writes the state only through the functions below, may copy it by value, and needs no call to drop it.

rmgui_element_sway_t.lean

progress on a scaled target, signed

rmgui_element_sway_t.travel_px

pointer travel since the last speed sample

rmgui_element_sway_t.sample_ms

clock stepped since the last speed sample

rmgui_element_sway_t.idle_ms

until the lean heads upright; 0: not armed

rmgui_element_sway_t.dragging

1 between a grab and its release

Field Documentation

◆ lean

rmgui_motion_spring_t rmgui_element_sway_t::lean

◆ travel_px

int32_t rmgui_element_sway_t::travel_px

◆ sample_ms

uint32_t rmgui_element_sway_t::sample_ms

◆ idle_ms

uint32_t rmgui_element_sway_t::idle_ms

◆ dragging

uint8_t rmgui_element_sway_t::dragging

The documentation for this struct was generated from the following file: