pub struct PaneAffordanceMotion {
pub reduced_motion: bool,
pub fade_in_frames: u16,
pub pulse_period_frames: u16,
pub pulse_floor_bps: u16,
}Expand description
Deterministic micro-animation policy for pane affordances (bd-18yus).
Pane affordances (splitter handles, focus emphasis, snap previews) gain a
subtle emphasis ramp when they activate — a hover fade-in, a slow active
pulse — so a state change reads as motion rather than a hard cut. The policy
is host-agnostic and reports only a bounded emphasis weight in basis points
([0, 10_000]); hosts map that to blend weight / brightness themselves.
Design properties:
- Deterministic. Emphasis is a pure function of an integer phase tick supplied by the caller (a frame counter / animation clock), never a wall clock, and uses integer-only math — so replays and snapshots are byte-stable across platforms with no floating-point drift.
- Reduced-motion safe. When
reduced_motionis set, every ramp collapses to a step function: emphasis jumps to its terminal value on the first frame. No semantic cue is lost — the affordance still changes state — only the in-between motion is removed, satisfying the reduced-motion behavior-parity requirement. - Bounded & cheap. Each query is constant-time, allocation-free integer arithmetic (a couple of multiplies and a divide), so per-affordance, per-frame overhead is negligible even with many splitters on screen.
Fields§
§reduced_motion: boolWhen set, all ramps collapse to instantaneous steps (no in-between frames), preserving the state change without motion.
fade_in_frames: u16Frames over which a hover emphasis fades in (≈100 ms at 60 fps by default). Zero means “instant”.
pulse_period_frames: u16Period of the active-state pulse in frames (≈0.8 s at 60 fps by default). Zero disables the pulse (steady full emphasis).
pulse_floor_bps: u16Low point of the active pulse in basis points; the pulse oscillates between this floor and full emphasis.
Implementations§
Source§impl PaneAffordanceMotion
impl PaneAffordanceMotion
Sourcepub fn reduced() -> Self
pub fn reduced() -> Self
The reduced-motion preset: identical timing fields, but every ramp is stepped. Use this when the host reports a reduced-motion preference.
Sourcepub fn with_reduced_motion(self, reduced_motion: bool) -> Self
pub fn with_reduced_motion(self, reduced_motion: bool) -> Self
Apply a reduced-motion preference to this policy, returning the adjusted copy. Lets a host derive the effective policy from a preference flag.
Sourcepub fn hover_emphasis_bps(&self, elapsed_frames: u16) -> u16
pub fn hover_emphasis_bps(&self, elapsed_frames: u16) -> u16
Hover emphasis ramp in basis points.
elapsed_frames counts frames since the affordance entered the hovered
state. The ramp is a quadratic ease-out from 0 to full over
fade_in_frames. Under reduced motion (or a zero
fade) it returns full emphasis immediately.
Sourcepub fn active_pulse_bps(&self, phase_frames: u64) -> u16
pub fn active_pulse_bps(&self, phase_frames: u64) -> u16
Active (dragging) emphasis pulse in basis points.
phase_frames is a free-running frame counter; the pulse smoothly
ping-pongs between pulse_floor_bps and full
emphasis over pulse_period_frames. Under
reduced motion (or a zero period) it returns steady full emphasis.
Trait Implementations§
Source§impl Clone for PaneAffordanceMotion
impl Clone for PaneAffordanceMotion
Source§fn clone(&self) -> PaneAffordanceMotion
fn clone(&self) -> PaneAffordanceMotion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more