pub struct GlassMorph {
pub node_size: (f32, f32),
pub primary: (f32, f32, f32, f32, f32),
pub shapes: Vec<(f32, f32, f32, f32, f32)>,
pub glue: f32,
pub wobble_amplitude: f32,
pub wobble_phase: f32,
pub bulge_amplitude: f32,
pub bulge_direction: f32,
pub ellipse_blend: f32,
pub deformation: Option<GlassDeformation>,
}Expand description
A liquid shapeshift frame: the primary shape plus any number of nearby
glass shapes, ALL smooth-unioned into one field — liquid glass glues to
whatever glass it passes near (a growing menu necks with a neighboring
button, the drag lens merges with the search circle). Up to
GlassMorph::MAX_SHAPES extra shapes; an angular wobble makes the
mid-flight field bubble like a droplet. All geometry is node-local dp:
(center_x, center_y, width, height, corner_radius); radius sentinel
-1 means capsule; -2 means SUBTRACT capsule — the shape carves a
smooth hole in the field (the growing menu leaves its anchor button
crisp on top until it swallows it).
Fields§
§node_size: (f32, f32)The glass node’s own size in dp. The shader receives all morph geometry in dp and derives px-per-dp from the renderer-injected node pixel rect divided by this — geometry then lands correctly at ANY render scale (live window density, robot captures at 1.0, fractional desktop scales). The authoring widget always knows its node size.
primary: (f32, f32, f32, f32, f32)§shapes: Vec<(f32, f32, f32, f32, f32)>Nearby glass shapes participating in the field.
glue: f32Smooth-union glue radius (dp): shapes within it neck together.
wobble_amplitude: f32Wobble amplitude (dp) and phase (radians).
wobble_phase: f32§bulge_amplitude: f32Viscous leading-edge bulge: while the shape travels or inflates, its
side facing bulge_direction (radians, math convention) swells like a
pulled droplet. Amplitude in dp, usually driven by morph velocity.
bulge_direction: f32§ellipse_blend: f32Blends the primary rounded-rectangle field toward an ellipse. This is used by expanding droplets whose broad phase has continuous curvature rather than the straight sides of a capsule.
deformation: Option<GlassDeformation>Area-preserving affine strain applied to the primary shape. Extra scene shapes remain fixed so nearby glass can join the travelling droplet without being dragged through its local deformation.
Implementations§
Source§impl GlassMorph
impl GlassMorph
Sourcepub const MAX_SHAPES: usize = 8
pub const MAX_SHAPES: usize = 8
Shader budget for extra scene shapes.
Trait Implementations§
Source§impl Clone for GlassMorph
impl Clone for GlassMorph
Source§fn clone(&self) -> GlassMorph
fn clone(&self) -> GlassMorph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more