pub enum ClipPath {
None,
Inset {
top: LengthPercentage,
right: LengthPercentage,
bottom: LengthPercentage,
left: LengthPercentage,
radius: Option<BorderRadius>,
},
Circle {
radius: LengthPercentage,
origin: Option<TransformOrigin>,
},
Ellipse {
rx: LengthPercentage,
ry: LengthPercentage,
origin: Option<TransformOrigin>,
},
Polygon {
points: Vec<(LengthPercentage, LengthPercentage)>,
},
Path {
d: String,
},
Blob {
radius: LengthPercentage,
origin: Option<TransformOrigin>,
lobes: u32,
wobble: f32,
seed: u32,
},
NodePath {
id: String,
},
Morph {
from: Box<ClipPath>,
to: Box<ClipPath>,
via: Vec<ClipPath>,
progress: f32,
},
}Variants§
None
Inset
Fields
top: LengthPercentageright: LengthPercentagebottom: LengthPercentageleft: LengthPercentageradius: Option<BorderRadius>Circle
Ellipse
Polygon
Fields
points: Vec<(LengthPercentage, LengthPercentage)>Path
Blob
A procedurally generated organic silhouette — the same wobbling-lobe
shape a blob scene transition grows across a whole cut, scoped
here to one element’s own clip instead. lobes control points sit
around a circle of radius, each nudged radially by a deterministic
noise scaled by wobble and picked by seed; the same three values
reproduce the same silhouette, byte for byte. wobble: 0 degenerates
to a plain circle, the same way radius alone does for circle.
Fields
radius: LengthPercentageorigin: Option<TransformOrigin>NodePath
Clip to another node’s own path geometry, by id, instead of a literal
d frozen at author time. The motivating shape: two copies of the
same gem, each clipped by the same animated “crack” node, so the two
halves separate along a coherent, shared edge — a literal
ClipPath::Path on each copy could not track the crack’s own
animation without duplicating it (and letting the two drift out of
sync the moment one copy’s d is edited and the other isn’t).
This mirrors node("id", "prop") in crate::expr’s grammar, which
reads another node’s already-resolved scalar through
Scope::node_prop; this variant instead names a node whose
geometry (its own resolved path — a shape with
ShapeType::Path, most naturally) should be read, so the (id, prop) pair that call uses does not apply — id alone is enough to
say which node.
Resolving id into an actual clip (finding the node, reading its
current-frame path, intersecting the canvas clip with it) is the
paint pipeline’s job, not this enum’s — same division as every other
ClipPath variant, none of which carry their own clipping logic
either.
Morph
A shape that sweeps continuously from from to to as progress
goes 0.0 → 1.0 (#384) — the chamfered-wall-style beat where the
clip itself is the animation, not a transform riding on top of a
frozen shape.
progress is meant to be driven by an ordinary keyframes animation
on the clip_path_progress property (see KNOWN_MOTION_PROPERTIES);
the literal value here is only the resting position when nothing
animates it.
from and to must be the same variant — and, for polygon, the
same vertex count — for the paint pass to have a correspondence to
interpolate along. A mismatch is reported on stderr and the node is
left unclipped for that frame; see engine::paint_pass::morph_clip_path_to_skia.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ClipPath
impl<'de> Deserialize<'de> for ClipPath
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ClipPath
impl JsonSchema for ClipPath
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for ClipPath
Auto Trait Implementations§
impl Freeze for ClipPath
impl RefUnwindSafe for ClipPath
impl Send for ClipPath
impl Sync for ClipPath
impl Unpin for ClipPath
impl UnsafeUnpin for ClipPath
impl UnwindSafe for ClipPath
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
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> ⓘ
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