Switch

class manim_eng.components.switches.Switch(closed: bool = False, **kwargs: Any)

Bases: BipoleSwitchBase

Circuit symbol for a basic two-terminal lever-arm switch.

Parameters:

closed (bool) – Whether the switch should be initially closed or not.

Attributes

Switch.animate

Used to animate the application of any method of self.

Switch.animation_overrides

Switch.color

Switch.depth

The depth of the mobject.

Switch.fill_color

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

Switch.height

The height of the mobject.

Switch.left

Return the left-hand terminal of the component.

Switch.n_points_per_curve

Switch.right

Return the right-hand terminal of the component.

Switch.sheen_factor

Switch.stroke_color

Switch.terminals

The list of terminals of the component.

Switch.width

The width of the mobject.

_construct() None

Construct the shape of the component.

Code to build the component’s symbol goes in here and not in __init__() (contrary to Manim’s standard). This is because the base Component class has to perform initialisation both before (to set up the groups etc.) and after (to set the anchor positions for annotations) the component’s shape setup.

close() Self

Close the switch, if not already closed.

open() Self

Open the switch, if not already open.