pub trait NodeBuilder: Sized + 'static {
type Handle;
Show 37 methods
// Provided methods
fn name(self, v: impl Into<String>) -> Self { ... }
fn x(self, v: f64) -> Self { ... }
fn y(self, v: f64) -> Self { ... }
fn position(self, v: impl Into<Vec2>) -> Self { ... }
fn rotation(self, v: f64) -> Self { ... }
fn scale(self, v: f64) -> Self { ... }
fn scale_xy(self, v: impl Into<Vec2>) -> Self { ... }
fn opacity(self, v: f64) -> Self { ... }
fn fill(self, v: impl IntoPaint) -> Self { ... }
fn stroke(self, v: impl IntoPaint) -> Self { ... }
fn line_width(self, v: f64) -> Self { ... }
fn start(self, v: f64) -> Self { ... }
fn end(self, v: f64) -> Self { ... }
fn fill_gradient(self, g: Gradient) -> Self { ... }
fn stroke_gradient(self, g: Gradient) -> Self { ... }
fn dash(self, pattern: impl Into<Vec<f64>>) -> Self { ... }
fn dash_offset(self, v: f64) -> Self { ... }
fn line_cap(self, v: LineCap) -> Self { ... }
fn line_join(self, v: LineJoin) -> Self { ... }
fn blur(self, v: f64) -> Self { ... }
fn shadow(
self,
color: impl IntoPaint,
blur: f64,
offset: impl Into<Vec2>,
) -> Self { ... }
fn elevation(self, step: Step) -> Self { ... }
fn glow(self, color: impl IntoPaint, blur: f64) -> Self { ... }
fn clip(self, v: bool) -> Self { ... }
fn blend(self, v: BlendMode) -> Self { ... }
fn z_index(self, v: f64) -> Self { ... }
fn anchor(self, v: impl Into<Vec2>) -> Self { ... }
fn grow(self, v: f64) -> Self { ... }
fn shrink(self, v: f64) -> Self { ... }
fn basis(self, v: f64) -> Self { ... }
fn margin(self, v: impl Len) -> Self { ... }
fn align_self(self, v: LayoutAlign) -> Self { ... }
fn next_to(self, other: impl Into<Node>, side: Side) -> Self { ... }
fn align_to(self, other: impl Into<Node>, edge: Edge) -> Self { ... }
fn to_edge(self, edge: Edge) -> Self { ... }
fn center_in(self, other: impl Into<Node>) -> Self { ... }
fn child<C: NodeBuilder>(self, child: C) -> Self { ... }
}Expand description
Describes a node before it is added to the scene.
Required Associated Types§
Provided Methods§
Sourcefn name(self, v: impl Into<String>) -> Self
fn name(self, v: impl Into<String>) -> Self
Name shown in the editor and in oxframe check / oxframe inspect.
Without it, the node is labeled by the add call site (src/main.rs:42).
Sourcefn position(self, v: impl Into<Vec2>) -> Self
fn position(self, v: impl Into<Vec2>) -> Self
Sets x and y together, e.g. .position((100.0, -50.0)).
Sourcefn fill(self, v: impl IntoPaint) -> Self
fn fill(self, v: impl IntoPaint) -> Self
Fill color: a Color or a theme role such as Accent.
Default: transparent, except text, which uses the theme’s text color.
Sourcefn stroke(self, v: impl IntoPaint) -> Self
fn stroke(self, v: impl IntoPaint) -> Self
Outline color; also set line_width. A theme role works the same as a color.
Default: transparent.
Sourcefn line_width(self, v: f64) -> Self
fn line_width(self, v: f64) -> Self
Outline width in pixels. Default: 0 (no outline).
Sourcefn end(self, v: f64) -> Self
fn end(self, v: f64) -> Self
End of the drawn part of the outline; animate 0 → 1 to draw it on.
Sourcefn fill_gradient(self, g: Gradient) -> Self
fn fill_gradient(self, g: Gradient) -> Self
Gradient fill (local coordinates, origin at the node center);
overrides fill.
Sourcefn stroke_gradient(self, g: Gradient) -> Self
fn stroke_gradient(self, g: Gradient) -> Self
Gradient outline; overrides stroke.
Sourcefn dash(self, pattern: impl Into<Vec<f64>>) -> Self
fn dash(self, pattern: impl Into<Vec<f64>>) -> Self
Dash pattern: on, off, on, … lengths. Animate dash_offset for
marching ants.
Sourcefn dash_offset(self, v: f64) -> Self
fn dash_offset(self, v: f64) -> Self
Shifts the dash pattern along the outline.
Sourcefn blur(self, v: f64) -> Self
fn blur(self, v: f64) -> Self
Gaussian blur of the node and its children (standard deviation, in the node’s units).
Sourcefn shadow(
self,
color: impl IntoPaint,
blur: f64,
offset: impl Into<Vec2>,
) -> Self
fn shadow( self, color: impl IntoPaint, blur: f64, offset: impl Into<Vec2>, ) -> Self
Drop shadow under the node and its children.
Sourcefn elevation(self, step: Step) -> Self
fn elevation(self, step: Step) -> Self
The theme’s shadow for this step (Xs and Sm are the small one, Xl the large).
Sourcefn anchor(self, v: impl Into<Vec2>) -> Self
fn anchor(self, v: impl Into<Vec2>) -> Self
Pivot and placement point: (-1, -1) top-left … (1, 1) bottom-right.
Sourcefn shrink(self, v: f64) -> Self
fn shrink(self, v: f64) -> Self
Inside a Layout: how much this node gives up when space is short.
Sourcefn margin(self, v: impl Len) -> Self
fn margin(self, v: impl Len) -> Self
Inside a Layout: space around this node, in pixels or a theme step (.margin(Md)).
Sourcefn align_self(self, v: LayoutAlign) -> Self
fn align_self(self, v: LayoutAlign) -> Self
Inside a Layout: overrides the layout’s cross-axis alignment.
Sourcefn next_to(self, other: impl Into<Node>, side: Side) -> Self
fn next_to(self, other: impl Into<Node>, side: Side) -> Self
Sits just outside other, on side. The gap is the theme’s Md
step. Recomputed every frame, so this node follows other.
Sourcefn align_to(self, other: impl Into<Node>, edge: Edge) -> Self
fn align_to(self, other: impl Into<Node>, edge: Edge) -> Self
Lines this node’s edge up with the same edge of other.
Sourcefn to_edge(self, edge: Edge) -> Self
fn to_edge(self, edge: Edge) -> Self
Pins one edge to the safe area (not the raw frame edge). The other
axis stays at x or y.
Sourcefn center_in(self, other: impl Into<Node>) -> Self
fn center_in(self, other: impl Into<Node>) -> Self
Same center as other. Pass the view to center in the frame.
Sourcefn child<C: NodeBuilder>(self, child: C) -> Self
fn child<C: NodeBuilder>(self, child: C) -> Self
Adds a child created together with this node. Use Node::add when
you need the child’s handle.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".