pub struct Morph { /* private fields */ }Expand description
An animation between two RoundedPolygons of any structure: both
outlines cut into matching curves. See androidx.graphics.shapes.Morph.
Implementations§
Source§impl Morph
impl Morph
Sourcepub fn new(start: &RoundedPolygon, end: &RoundedPolygon) -> Self
pub fn new(start: &RoundedPolygon, end: &RoundedPolygon) -> Self
Match start and end. This measures both outlines, so hold on to
the result: ShapeKind::morph_to keeps
one per pair of Material shapes.
Sourcepub fn with_matching(
start: &RoundedPolygon,
end: &RoundedPolygon,
matching: MorphMatching,
) -> Self
pub fn with_matching( start: &RoundedPolygon, end: &RoundedPolygon, matching: MorphMatching, ) -> Self
Self::new, matching the outlines by matching.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the morph has no curves. Polygons always give it at least one.
Sourcepub fn for_each_cubic(&self, progress: f32, each: impl FnMut(&Cubic))
pub fn for_each_cubic(&self, progress: f32, each: impl FnMut(&Cubic))
Visit the outline at progress, without allocating: 0 is the start
shape, 1 the end shape, and values beyond them extrapolate, for a
spring’s overshoot.
Sourcepub fn as_cubics(&self, progress: f32) -> Vec<Cubic>
pub fn as_cubics(&self, progress: f32) -> Vec<Cubic>
The outline at progress, closed exactly on its first anchor.
Sourcepub fn bounds(&self, approximate: bool) -> [f32; 4]
pub fn bounds(&self, approximate: bool) -> [f32; 4]
The box covering both shapes’ RoundedPolygon::bounds.
Sourcepub fn max_bounds(&self) -> [f32; 4]
pub fn max_bounds(&self) -> [f32; 4]
The box covering both shapes’ RoundedPolygon::max_bounds.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Morph
impl RefUnwindSafe for Morph
impl Send for Morph
impl Sync for Morph
impl Unpin for Morph
impl UnsafeUnpin for Morph
impl UnwindSafe for Morph
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more