pub trait SpringTarget: 'static {
type Output;
// Required methods
fn target(&self) -> f32;
fn resolve(&self, value: f32) -> Self::Output;
}Expand description
A value that a one-dimensional spring can target.
The spring solver works on one f32 coordinate. A target maps its value into that coordinate
and maps the sampled coordinate back into the output consumed by the animator. Built-in targets
are f32, Pixels, Rems, AnimationPhase and bool
(which maps to 0.0 or 1.0).
§Examples
use gpui::{SpringTarget, px};
assert_eq!(px(12.).target(), 12.0);
assert_eq!(px(12.).resolve(14.0), px(14.));
assert_eq!(true.target(), 1.0);Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".