Skip to main content

PaneAffordanceMotion

Struct PaneAffordanceMotion 

Source
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_motion is 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: bool

When set, all ramps collapse to instantaneous steps (no in-between frames), preserving the state change without motion.

§fade_in_frames: u16

Frames over which a hover emphasis fades in (≈100 ms at 60 fps by default). Zero means “instant”.

§pulse_period_frames: u16

Period 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: u16

Low point of the active pulse in basis points; the pulse oscillates between this floor and full emphasis.

Implementations§

Source§

impl PaneAffordanceMotion

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> PaneAffordanceMotion

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PaneAffordanceMotion

Source§

impl Debug for PaneAffordanceMotion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PaneAffordanceMotion

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for PaneAffordanceMotion

Source§

impl PartialEq for PaneAffordanceMotion

Source§

fn eq(&self, other: &PaneAffordanceMotion) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PaneAffordanceMotion

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.