Skip to main content

VState

Struct VState 

Source
pub struct VState {
    pub path: VPath,
    pub fill: Color,
    pub stroke: Stroke,
    pub opacity: f32,
    pub z_index: i32,
    pub draw_range: Range<f32>,
}
Expand description

The animatable state of a shape.

Fields§

§path: VPath

The geometry, in scene units (y up).

§fill: Color

Fill color; transparent by default.

§stroke: Stroke

Outline.

§opacity: f32

Overall opacity multiplier.

§z_index: i32

Draw order; higher is on top, ties broken by id.

§draw_range: Range<f32>

Fraction 0..1 of arc length that is drawn; driven by create.

Implementations§

Source§

impl VState

Source

pub fn new(path: VPath) -> Self

A shape with manim’s default style: white 0.04-unit outline, no fill.

Source

pub fn circle(radius: f64) -> Self

Circle centered on the origin.

Source

pub fn arc(radius: f64, start: f64, sweep: f64) -> Self

Arc around the origin, sweep radians counter-clockwise from start.

Source

pub fn rectangle(width: f64, height: f64) -> Self

Axis-aligned rectangle centered on the origin.

Source

pub fn square(side: f64) -> Self

Square centered on the origin.

Source

pub fn polygon(points: &[Point]) -> Self

Closed polygon through points.

Source

pub fn line(a: Point, b: Point) -> Self

Line segment.

Source

pub fn function_graph( f: impl Fn(f64) -> f64, x_range: Range<f64>, segments: usize, ) -> Self

Graph of y = f(x) over x_range (scene units), as segments smooth cubics (Hermite, slopes by central difference).

Source

pub fn dot(p: Point) -> Self

Small filled white dot at p.

Source

pub fn fill(self, fill: Color) -> Self

Sets the fill color.

Source

pub fn stroke(self, color: Color, width: f64) -> Self

Sets the outline.

Source

pub fn z_index(self, z_index: i32) -> Self

Sets the draw order.

Source

pub fn transform(self, a: Affine) -> Self

Applies an affine transform to the geometry.

Source

pub fn shift(self, v: Vec2) -> Self

Translates by v.

Source

pub fn move_to(self, p: Point) -> Self

Moves so the bounding-box center is at p.

Source

pub fn scale(self, factor: f64) -> Self

Scales about the bounding-box center.

Source

pub fn rotate(self, angle: f64) -> Self

Rotates counter-clockwise by angle radians about the bounding-box center.

Trait Implementations§

Source§

impl Clone for VState

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 VState

Source§

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

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

impl Interpolate for VState

Source§

fn lerp(a: &Self, b: &Self, t: f32) -> Self

Lerps every field. Paths must already be aligned.

Source§

impl PartialEq for VState

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 Position for VState

Source§

fn bbox(&self) -> Option<Rect>

Tight bounding box, or None if empty.
Source§

fn transform(self, a: Affine) -> Self

Applies an affine transform to the geometry.
Source§

fn next_to(self, other: &impl Position, dir: Vec2, buff: f64) -> Self

Places this buff units from other in direction dir, centered on it along the other axis, manim’s next_to (e.g. label.next_to(&dot, UP, DEFAULT_BUFF)). A diagonal dir places it off a corner.
Source§

fn align_to(self, other: &impl Position, dir: Vec2) -> Self

Lines up this edge in direction dir with the same edge of other, moving only along the axes where dir is nonzero, manim’s align_to (e.g. LEFT aligns left edges).
Source§

fn to_edge(self, dir: Vec2) -> Self

Moves against the frame edge in direction dir (e.g. UP, or UP + LEFT for a corner), leaving manim’s 0.5-unit gap.
Source§

impl StructuralPartialEq for VState

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> 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> 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.