Circuit

class manim_eng.circuits.circuit.Circuit(*components: Component)

Bases: VMobject

Circuit manager to conveniently handle components and their connections.

Parameters:

*components (Component) – Components to add to the circuit at initialisation.

Attributes

Circuit.animate

Used to animate the application of any method of self.

Circuit.animation_overrides

Circuit.color

Circuit.depth

The depth of the mobject.

Circuit.elements

Returns a list of all components (including nodes) in the circuit.

Circuit.fill_color

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

Circuit.height

The height of the mobject.

Circuit.n_points_per_curve

Circuit.sheen_factor

Circuit.stroke_color

Circuit.width

The width of the mobject.

add(*components: Component) Self

Add one or more components to the circuit.

Parameters:

*components (Component) – The component(s) to add.

connect(start: Terminal, end: Terminal) Self

Connect two terminals together.

Parameters:
  • start (Terminal) – The terminal the connecting wire should start at.

  • end (Terminal) – The terminal the connecting wire should end at.

Raises:
  • ValueError – If the two terminals passed are identical.

  • ValueError – If either terminal doesn’t belong to a component in this circuit.

disconnect(*components_or_terminals: Component | Terminal) Self

Disconnect the given components and/or terminals from one another.

Each wire is checked to see if both the start and end terminals have been passed or belong to a component that was passed. If this is the case, the wire will be removed.

Parameters:

*components_or_terminals (Component | Terminal) – The group of components and terminals to disconnect from one another.

Raises:

ValueError – If any passed terminal does not belong to a component in this circuit.

See also

isolate

Remove a wire if either of its ends is specified.

property elements: list[Component]

Returns a list of all components (including nodes) in the circuit.

isolate(*components_or_terminals: Component | Terminal) Self

Remove all wires attached to each given terminal or component.

Each wire is checked to see if either of its ends is a passed terminal or a terminal on a passed component. If this is the case, the wire will be removed.

Parameters:

*components_or_terminals (Component | Terminal) – The components and terminals to completely disconnect from the circuit.

Raises:

ValueError – If any passed terminal does not belong to a component in this circuit.

See also

disconnect

Remove a wire if both its ends are specified.

remove(*components: Component) Self

Remove one or more components from the circuit.

Parameters:

*components (Component) – The component(s) to remove.