Skip to main content

Matrix

Struct Matrix 

Source
pub struct Matrix { /* private fields */ }
Expand description

Values in a grid between square brackets. Each cell is a Txt, so cell(1, 0).text().set("7") changes it and .fill() colors it. row_frame and column_frame give outlines that fade in to point at a row or a column.

ⓘ
let a = view.add(Matrix::new([[1, 2], [3, 4]]));
let r = a.row_frame(0);
r.fade_in().await;
a.cell(0, 1).fill().to(Accent.into(), 0.3).await;

Implementations§

Source§

impl Matrix

Source

pub fn new<R, V>(rows: impl IntoIterator<Item = R>) -> MatrixBuilder
where R: IntoIterator<Item = V>, V: Display,

A matrix from rows of values: numbers, &str or anything that implements Display. Rows shorter than the longest get empty cells.

Source

pub fn cell(&self, row: usize, column: usize) -> Txt

The cell in row row, column column (both from 0).

§Panics

If the cell is outside the matrix.

Source

pub fn row(&self, row: usize) -> Vec<Txt>

The cells of a row, left to right.

Source

pub fn column(&self, column: usize) -> Vec<Txt>

The cells of a column, top to bottom.

Source

pub fn rows(&self) -> usize

Number of rows.

Source

pub fn columns(&self) -> usize

Number of columns.

Source

pub fn brackets(&self) -> [Path; 2]

The left and right bracket.

Source

pub fn row_frame(&self, row: usize) -> Rect

A rounded outline around row row, hidden: .fade_in() shows it.

Source

pub fn column_frame(&self, column: usize) -> Rect

A rounded outline around column column, hidden.

Source

pub fn cell_frame(&self, row: usize, column: usize) -> Rect

A rounded outline around one cell, hidden.

Source

pub fn node(&self) -> Node

The untyped node handle.

Methods from Deref<Target = Node>§

Source

pub fn id(self) -> NodeId

Index of the node in the scene graph.

Source

pub fn x(self) -> Signal<f64>

The x property as an animatable signal.

Source

pub fn y(self) -> Signal<f64>

The y property as an animatable signal.

Source

pub fn rotation(self) -> Signal<f64>

Degrees, clockwise.

The rotation property as an animatable signal.

Source

pub fn scale(self) -> Signal<Vec2>

The scale property as an animatable signal.

Source

pub fn opacity(self) -> Signal<f64>

The opacity property as an animatable signal.

Source

pub fn fill(self) -> Signal<Color>

The fill property as an animatable signal.

Source

pub fn stroke(self) -> Signal<Color>

The stroke property as an animatable signal.

Source

pub fn line_width(self) -> Signal<f64>

The line_width property as an animatable signal.

Source

pub fn start(self) -> Signal<f64>

Start of the drawn part of the outline (fraction of its length).

The start property as an animatable signal.

Source

pub fn end(self) -> Signal<f64>

End of the drawn part of the outline.

The end property as an animatable signal.

Source

pub fn fill_gradient(self) -> Signal<Option<Gradient>>

The fill_gradient property as an animatable signal.

Source

pub fn stroke_gradient(self) -> Signal<Option<Gradient>>

The stroke_gradient property as an animatable signal.

Source

pub fn dash(self) -> Signal<Vec<f64>>

The dash property as an animatable signal.

Source

pub fn dash_offset(self) -> Signal<f64>

The dash_offset property as an animatable signal.

Source

pub fn line_cap(self) -> Signal<LineCap>

The line_cap property as an animatable signal.

Source

pub fn line_join(self) -> Signal<LineJoin>

The line_join property as an animatable signal.

Source

pub fn blur(self) -> Signal<f64>

The blur property as an animatable signal.

Source

pub fn shadow_color(self) -> Signal<Color>

The shadow_color property as an animatable signal.

Source

pub fn shadow_blur(self) -> Signal<f64>

The shadow_blur property as an animatable signal.

Source

pub fn shadow_offset(self) -> Signal<Vec2>

The shadow_offset property as an animatable signal.

Source

pub fn clip(self) -> Signal<bool>

The clip property as an animatable signal.

Source

pub fn blend(self) -> Signal<BlendMode>

The blend property as an animatable signal.

Source

pub fn z_index(self) -> Signal<f64>

The z_index property as an animatable signal.

Source

pub fn anchor(self) -> Signal<Vec2>

The anchor property as an animatable signal.

Source

pub fn grow(self) -> Signal<f64>

The grow property as an animatable signal.

Source

pub fn shrink(self) -> Signal<f64>

The shrink property as an animatable signal.

Source

pub fn basis(self) -> Signal<Option<f64>>

The basis property as an animatable signal.

Source

pub fn margin(self) -> Signal<f64>

The margin property as an animatable signal.

Source

pub fn align_self(self) -> Signal<Option<LayoutAlign>>

The align_self property as an animatable signal.

Source

pub fn add<B>(self, child: B) -> <B as NodeBuilder>::Handle
where B: NodeBuilder,

Adds a child node; children are positioned relative to the parent.

The call site is stored on the node (oxframe check and oxframe inspect print it). .name("title") overrides the automatic label.

Source

pub fn remove(self)

Detaches the node from its parent; it stops being drawn.

Source

pub fn fade_in(self) -> Tween<f64> ⓘ

Fades the node in from transparent, over the theme’s normal duration with its enter easing.

Source

pub fn pop_in(self) -> Tween<Vec2> ⓘ

Grows the node from nothing to its current scale with a small overshoot (the theme’s emphasis easing, OUT_BACK by default).

Source

pub fn draw_on(self) -> Tween<f64> ⓘ

Draws the outline from start to end (end from 0 to 1), as if with a pen. Works on every shape with an outline: paths, lines, rectangles, circles, polygons.

Source

pub fn slide_in(self, from: Side) -> impl Future<Output = ()> + 'static

Slides the node into its place from SLIDE_DISTANCE pixels towards from, fading in on the way.

Source

pub fn next_to(self, other: impl Into<Node>, side: Side) -> Node

Sits just outside other. The gap is the theme’s Md step, and the position is recomputed every frame.

Source

pub fn align_to(self, other: impl Into<Node>, edge: Edge) -> Node

Lines this node’s edge up with the same edge of other.

Source

pub fn to_edge(self, edge: Edge) -> Node

Pins one edge to the safe area. The other axis is left as it is.

Source

pub fn center_in(self, other: impl Into<Node>) -> Node

Same center as other.

Source

pub fn fade_out(self) -> Tween<f64> ⓘ

Fades the node out, over the theme’s normal duration with its exit easing.

Source

pub fn reparent(self, parent: impl Into<Node>)

Moves the node under another parent.

Source

pub fn effect(self, effect: EffectBuilder) -> Effect

Runs a shader effect on this node’s pixels, children included.

ⓘ
let ring = card.effect(shaders::ripple().strength(0.0));
ring.strength().to(1.0, 0.6).await;

A node has one effect; a second call replaces the first. The node must not sit inside a group with opacity below 1, a blur, a clip, a blend, a shadow or another effect: there its pixels are not finished, and check reports input_cycle.

Source

pub fn children(self) -> Vec<Node>

Direct children, in creation order.

Source

pub fn size(self) -> (f64, f64)

Size of the node’s box in its own coordinates.

Source

pub fn absolute_position(self) -> Vec2

Position of the node’s origin in scene coordinates.

Trait Implementations§

Source§

impl Clone for Matrix

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 Deref for Matrix

Source§

type Target = Node

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Node

Dereferences the value.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> ErasedDestructor for T
where T: 'static,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V