pub trait NodeModifiers: Into<Node> + Sized {
Show 20 methods
// Provided methods
fn layered_shadow(self, color: Color, radius: f64, offset: Vector2) -> Node { ... }
fn elevated(self, elevation: Elevation) -> Node { ... }
fn gate_weave(self, seed: u64, frame: u64, amount: f64) -> Node { ... }
fn next_to(self, reference: &Node, side: Side, gap: f64) -> Node { ... }
fn align_to(self, reference: &Node, edge: Side) -> Node { ... }
fn at(self, position: impl Into<Point>) -> Node { ... }
fn translate(self, horizontal: f64, vertical: f64) -> Node { ... }
fn rotate(self, radians: f64) -> Node { ... }
fn scale(self, factor: f64) -> Node { ... }
fn scale_xy(self, horizontal: f64, vertical: f64) -> Node { ... }
fn pivot(self, pivot: Pivot) -> Node { ... }
fn opacity(self, opacity: f64) -> Node { ... }
fn blend_mode(self, mode: BlendMode) -> Node { ... }
fn filter(self, filter: Filter) -> Node { ... }
fn clip(self, shape: impl Into<ShapeClip>) -> Node { ... }
fn clip_with(self, shape: impl Into<ShapeClip>, mode: ClipMode) -> Node { ... }
fn mask(self, mask: impl Into<Node>, mode: MaskMode) -> Node { ... }
fn z_index(self, index: i32) -> Node { ... }
fn visible(self, visible: bool) -> Node { ... }
fn named(self, name: &str) -> Node { ... }
}Expand description
Snapshot modifiers shared by all values convertible into a Node.
Placement, compositing, clipping and filters preserve immutable snapshots.
Provided Methods§
Sourcefn layered_shadow(self, color: Color, radius: f64, offset: Vector2) -> Node
fn layered_shadow(self, color: Color, radius: f64, offset: Vector2) -> Node
Layers three soft silhouettes behind a single untouched source snapshot.
Sourcefn elevated(self, elevation: Elevation) -> Node
fn elevated(self, elevation: Elevation) -> Node
Layers contact, key and ambient soft shadows that scale with an Elevation.
Sourcefn gate_weave(self, seed: u64, frame: u64, amount: f64) -> Node
fn gate_weave(self, seed: u64, frame: u64, amount: f64) -> Node
Repeatable physical gate drift, keyed only by an explicit frame and seed.
Sourcefn next_to(self, reference: &Node, side: Side, gap: f64) -> Node
fn next_to(self, reference: &Node, side: Side, gap: f64) -> Node
Places content next to the reference during compile-time layout.
Sourcefn align_to(self, reference: &Node, edge: Side) -> Node
fn align_to(self, reference: &Node, edge: Side) -> Node
Aligns an edge with a compile-time measured reference snapshot.
Sourcefn at(self, position: impl Into<Point>) -> Node
fn at(self, position: impl Into<Point>) -> Node
Places the selected pivot at a parent-space point, before translation.
Sourcefn translate(self, horizontal: f64, vertical: f64) -> Node
fn translate(self, horizontal: f64, vertical: f64) -> Node
Adds parent-space translation, after scale and rotation.
Sourcefn rotate(self, radians: f64) -> Node
fn rotate(self, radians: f64) -> Node
Adds clockwise radians about the pivot, after scale and before translation.
Sourcefn scale(self, factor: f64) -> Node
fn scale(self, factor: f64) -> Node
Multiplies both scale factors; negative factors reflect and zero collapses.
Sourcefn scale_xy(self, horizontal: f64, vertical: f64) -> Node
fn scale_xy(self, horizontal: f64, vertical: f64) -> Node
Multiplies per-axis scale factors about the pivot.
Sourcefn pivot(self, pivot: Pivot) -> Node
fn pivot(self, pivot: Pivot) -> Node
Replaces the local-space pivot; defaults to the layout-bounds center.
Sourcefn opacity(self, opacity: f64) -> Node
fn opacity(self, opacity: f64) -> Node
Replaces subtree opacity; invalid values are reported during conversion.
Sourcefn blend_mode(self, mode: BlendMode) -> Node
fn blend_mode(self, mode: BlendMode) -> Node
Blends the completed subtree once against its immediate parent backdrop.
Modes use the selected blend space and force isolation even at opacity one. This does not change layout bounds.
use motion_core::prelude::*;
use motion_core::{
DisplayList, RasterLimits, ResourcePool, ValidatedDisplayList, MAX_PATH_VERBS,
MAX_STROKE_VERBS, MAX_SVG_PATH_BYTES, sample_offsets,
};
let tile = || Node::from(Rect::new(0.0, 0.0, 1.0, 1.0).fill(Color::WHITE)).opacity(0.5);
let scene = Node::group([tile(), tile().blend_mode(BlendMode::Multiply)]);
let prepared = scene.compile(
Size::new(1.0, 1.0),
PixelSize::new(1, 1),
ValidationLimits::default(),
)?;Sourcefn filter(self, filter: Filter) -> Node
fn filter(self, filter: Filter) -> Node
Appends a source-only filter, preserving declaration order.
Filters process the completed subtree before this node’s content mask, clips, opacity and blend. Child effects complete before parent effects. Layout bounds stay unchanged. Distances transform from local design units; CPU preparation retains offscreen inputs and derives capture bounds.
use motion_core::prelude::*;
use motion_core::{
DisplayList, RasterLimits, ResourcePool, ValidatedDisplayList, MAX_PATH_VERBS,
MAX_STROKE_VERBS, MAX_SVG_PATH_BYTES, sample_offsets,
};
let node = Node::from(Rect::new(0.0, 0.0, 2.0, 2.0).fill(Color::WHITE))
.filter(Filter::Blur { sigma: 0.5 });
let output = node.compile(
Size::new(4.0, 4.0),
PixelSize::new(4, 4),
ValidationLimits::default(),
)?;Sourcefn clip(self, shape: impl Into<ShapeClip>) -> Node
fn clip(self, shape: impl Into<ShapeClip>) -> Node
Replaces the subtree’s local path-coverage clip without changing layout.
Coverage multiplies the completed isolated subtree once, before group opacity and blending. Nested masks multiply; this is not geometric path intersection. Use a checked Path2D or a PathClip with an explicit rule.
use motion_core::prelude::*;
use motion_core::{
DisplayList, RasterLimits, ResourcePool, ValidatedDisplayList, MAX_PATH_VERBS,
MAX_STROKE_VERBS, MAX_SVG_PATH_BYTES, sample_offsets,
};
let tile = || Node::from(Rect::new(0.0, 0.0, 2.0, 1.0).fill(Color::WHITE));
let path = Path2D::from_rect(Rect::new(0.5, 0.0, 2.0, 1.0))?;
let node = Node::group([tile(), tile()]).clip(path);
let prepared = node.compile(
Size::new(2.0, 1.0),
PixelSize::new(2, 1),
ValidationLimits::default(),
)?;Sourcefn clip_with(self, shape: impl Into<ShapeClip>, mode: ClipMode) -> Node
fn clip_with(self, shape: impl Into<ShapeClip>, mode: ClipMode) -> Node
Clips with explicit coverage multiplication or geometric intersection.
Sourcefn mask(self, mask: impl Into<Node>, mode: MaskMode) -> Node
fn mask(self, mask: impl Into<Node>, mode: MaskMode) -> Node
Replaces the local geometric rectangle clip without changing layout.
Nested rectangles intersect in device space before coverage quantization, including rotated/reflected rectangles. Repeating an edge does not fade it again. The completed subtree is clipped once before opacity/blending. Path clips and content masks remain independent multiplicative coverage. RectClip allows a separate local transform. Invalid hidden clips fail validation; zero area is empty.
use motion_core::prelude::*;
use motion_core::{
DisplayList, RasterLimits, ResourcePool, ValidatedDisplayList, MAX_PATH_VERBS,
MAX_STROKE_VERBS, MAX_SVG_PATH_BYTES, sample_offsets,
};
let rect = Rect::new(0.5, 0.0, 2.0, 1.0);
let inner = Node::from(Rect::new(0.0, 0.0, 2.0, 1.0).fill(Color::WHITE))
.clip_with(rect, motion_core::ClipMode::Geometric);
let frame = Node::group([inner])
.clip_with(rect, motion_core::ClipMode::Geometric)
.compile(
Size::new(2.0, 1.0),
PixelSize::new(2, 1),
ValidationLimits::default(),
)?;Replaces the geometric Shape snapshot without changing layout.
Shapes and rectangles intersect before coverage quantization. NonZero is the default; ShapeClip exposes an independent rule and local transform. Path coverage masks and content masks still multiply independently. Curves use the preparation tolerance, not a pixel-area error guarantee.
use motion_core::prelude::*;
use motion_core::{
DisplayList, RasterLimits, ResourcePool, ValidatedDisplayList, MAX_PATH_VERBS,
MAX_STROKE_VERBS, MAX_SVG_PATH_BYTES, sample_offsets,
};
let mut triangle = Path2D::new();
triangle
.move_to(Point::ORIGIN)
.line_to(Point::new(1.0, 0.0))
.line_to(Point::new(0.0, 1.0));
let inner = Node::from(Rect::new(0.0, 0.0, 1.0, 1.0).fill(Color::WHITE))
.clip_with(triangle.clone(), motion_core::ClipMode::Geometric);
let frame = Node::group([inner])
.clip_with(triangle, motion_core::ClipMode::Geometric)
.compile(
Size::new(1.0, 1.0),
PixelSize::new(1, 1),
ValidationLimits::default(),
)?;Replaces the subtree’s alpha or linear-luminance content mask.
Mask artwork uses the source’s local coordinate system and a transparent isolated backdrop. It does not contribute layout bounds. The completed mask scales content once, before path clipping, opacity and blending. Inverted modes complement clamped coverage, not color or alpha first. Empty or transparent mask regions then preserve existing source pixels; they do not create source artwork or enlarge its capture bounds.
use motion_core::prelude::*;
use motion_core::{
DisplayList, RasterLimits, ResourcePool, ValidatedDisplayList, MAX_PATH_VERBS,
MAX_STROKE_VERBS, MAX_SVG_PATH_BYTES, sample_offsets,
};
let tile = |color| Node::from(Rect::new(0.0, 0.0, 1.0, 1.0).fill(color));
let node = tile(Color::WHITE).mask(
tile(Color::from_hex(0xff0000).with_alpha(0.5)),
MaskMode::Luminance,
);
let frame = node.compile(
Size::new(1.0, 1.0),
PixelSize::new(1, 1),
ValidationLimits::default(),
)?;use motion_core::prelude::*;
use motion_core::{
DisplayList, RasterLimits, ResourcePool, ValidatedDisplayList, MAX_PATH_VERBS,
MAX_STROKE_VERBS, MAX_SVG_PATH_BYTES, sample_offsets,
};
let source = Node::from(Rect::new(1.0, 0.0, 3.0, 1.0).fill(Color::WHITE));
let mask = Node::from(Rect::new(1.0, 0.0, 2.0, 1.0).fill(Color::WHITE));
let frame = source.mask(mask, MaskMode::InvertedAlpha).compile(
Size::new(4.0, 1.0),
PixelSize::new(4, 1),
ValidationLimits::default(),
)?;Sourcefn z_index(self, index: i32) -> Node
fn z_index(self, index: i32) -> Node
Replaces sibling-local stacking order; ties retain insertion order.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".