Voltage

class manim_eng.circuits.voltage.Voltage(start: Terminal, end: Terminal, label: str | Value, clockwise: bool = False, buff: float = 0.1, avoid: VMobject | None = None, component_buff: float = 0.15)

Bases: Markable

Voltage arrow between two terminal endpoints.

Warning

manim-eng currently uses arcs of up to $pi$ (180º) to build voltage arrows, so any label or annotation that requires an arc of more than a semicircle to get round it will result in overflow into an arc that is too small.

This is a known issue and should be fixed in the 0.2 release by using polynomial arrow forms.

Parameters:
  • start (Terminal) – The terminal the non-tip end of the arrow should be attached to, i.e. the ‘negative’ end.

  • end (Terminal) – The terminal the tip end of the arrow should be attached to, i.e. the ‘positive’ end.

  • label (str | Value) – The label for the voltage arrow. Takes a TeX math mode string, or a Value to be typeset as a math mode string.

  • clockwise (bool) – Whether the arrow should go clockwise or anticlockwise. The default is anticlockwise.

  • buff (float) – The buffer to use when attaching the arrow to the terminal ends.

  • avoid (VMobject | None) – If a vmoject is specified, the arrow will go around it (including, if the vmobject is a component, labels or annotations attached to the component). If no component is specified, the arrow will take a default curvature.

  • component_buff (float) – The buffer to use between the component body and the arrow, if a component to avoid is specified.

Attributes

Voltage.animate

Used to animate the application of any method of self.

Voltage.animation_overrides

Voltage.color

Voltage.depth

The depth of the mobject.

Voltage.fill_color

If there are multiple colors (for gradient) this returns the first one

Voltage.height

The height of the mobject.

Voltage.n_points_per_curve

Voltage.sheen_factor

Voltage.stroke_color

Voltage.width

The width of the mobject.

flip_direction(flip_sense_as_well: bool = True) Self

Flip the direction of the voltage arrow.

Parameters:

flip_sense_as_well (bool) – Whether to flip the sense of the arrow as well (clockwise to anticlockwise or anticlockwise to clockwise), so that the arrow remains on the same side of the component. Defaults to True.

reset_label(label: str | Value, clockwise: bool = False) Self

Set the voltage label, with the sense being reset to default if unspecified.

Parameters:
  • label (str | Value) – The label to set. Takes a TeX math mode string, or a Value to be typeset as a math mode string.

  • clockwise (bool) – Whether the arrow should go clockwise or anticlockwise. If unspecified, takes the default setting (False).

See also

set_label

Set the voltage label, with the sense of the arrow being left as-is if unspecified.

set_anticlockwise() Self

Set the sense of the voltage arrow to be anticlockwise.

set_clockwise(clockwise: bool = True) Self

Set the sense of the voltage arrow (clockwise or anticlockwise).

Parameters:

clockwise (bool) – Whether the arrow should be clockwise (True) or anticlockwise (False). Defaults to clockwise.

set_end(terminal: Terminal) Self

Set the terminal the arrow should point to.

Parameters:

terminal (Terminal) – The terminal that should be at the tip end of the voltage arrow.

set_label(label: str | Value, clockwise: bool | None = None) Self

Set the voltage label.

Parameters:
  • label (str | Value) – The label to set. Takes a TeX math mode string, or a Value to be typeset as a math mode string.

  • clockwise (bool | None) – Whether the arrow should go clockwise or anticlockwise. If unspecified, takes the previous setting.

See also

reset_label

Set the voltage label, with the sense of the arrow being reset to default if unspecified.

set_start(terminal: Terminal) Self

Set the terminal the arrow should start from.

Parameters:

terminal (Terminal) – The terminal that should be at the non-tip end of the voltage arrow.

set_terminals(start: Terminal | None = None, end: Terminal | None = None) Self

Set the terminal(s) the arrow goes from/to.

Parameters:
  • start (Terminal | None) – The terminal to attach the start of the arrow to.

  • end (Terminal | None) – The terminal to attach the end of the arrow to.

Raises:

ValueError – If neither start or end are specified.

See also

set_start, set_end