Skip to main content

ClipPath

Enum ClipPath 

Source
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

§

Circle

§

Ellipse

§

Polygon

§

Path

Fields

§

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

§lobes: u32

How many lobes the silhouette grows. Same field as transition.lobes.

§wobble: f32

How far each lobe’s radius wanders from a perfect circle, as a fraction of it. Same field as transition.wobble.

§seed: u32

Stable selector for the lobe noise, same selector as pixel_dissolve.seed and transition.seed.

§

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.

Fields

§

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.

Fields

§via: Vec<ClipPath>

Shapes the morph passes through on its way from from to to, in order. Empty means a direct two-shape sweep, which is what a morph without this field has always been.

progress spans the whole chain, not each leg: with one via shape, 0.5 is exactly that shape.

§progress: f32

Trait Implementations§

Source§

impl Clone for ClipPath

Source§

fn clone(&self) -> Self

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 Debug for ClipPath

Source§

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

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

impl<'de> Deserialize<'de> for ClipPath

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for ClipPath

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for ClipPath

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for ClipPath

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ClipPath

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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.