Node

class manim_eng.components.node.Node(open_: bool = False, autoblob: bool = True, **kwargs: Any)

Bases: Component

Node in a circuit and open/filled terminal circuit symbol.

Node handles two main purposes: it displays node symbols (open terminal symbols and solder blobs), and serves as an aid for wire routing, particularly when paired with updaters.

Parameters:
  • open (bool) – Whether to display an open or filled circle for the node. Open ones are typically used for external connections to a circuit (i.e. loose ends), whereas filled ones are used for ‘solder blobs’ to indicated that three or more wires connect.

  • autoblob (bool) – Whether to handle the addition/removal of solder blobs automatically. Has no effect if the node is open (as autoblobbing only makes sense for solder blobs).

Attributes

Node.animate

Used to animate the application of any method of self.

Node.animation_overrides

Node.color

Node.depth

The depth of the mobject.

Node.down

Get the down-pointing terminal of the node, creating it if necessary.

Node.down_left

Get the down-left-pointing terminal of the node, creating it if necessary.

Node.down_right

Get down-right-pointing terminal of the node, creating it if necessary.

Node.fill_color

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

Node.height

The height of the mobject.

Node.left

Get the left-pointing terminal of the node, creating it if necessary.

Node.n_points_per_curve

Node.right

Get the right-pointing terminal of the node, creating it if necessary.

Node.sheen_factor

Node.stroke_color

Node.terminals

The list of terminals of the component.

Node.up

Get the up-pointing terminal of the node, creating it if necessary.

Node.up_left

Get the up-left-pointing terminal of the node, creating it if necessary.

Node.up_right

Get the up-right-pointing terminal of the node, creating it if necessary.

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

clear_annotation() Self

Fails for nodes, as they do not have annotations.

disable_autoblobbing() Self

Disable autoblobbing for the node.

Will not have an effect if the node is of an open type.

property down: Terminal

Get the down-pointing terminal of the node, creating it if necessary.

property down_left: Terminal

Get the down-left-pointing terminal of the node, creating it if necessary.

property down_right: Terminal

Get down-right-pointing terminal of the node, creating it if necessary.

enable_autoblobbing() Self

Enable autoblobbing for the node.

If the node is of a filled type, an autoblob calculation will be made to decide whether to display the blob or not, and the node display updated accordingly. Will not have an effect if the node is of an open type.

get(direction: ndarray[tuple[Any, ...], dtype[float64]] | float) Terminal

Get a terminal of the node in a given direction, creating it if necessary.

Parameters:

direction (mnt.Vector3D | float) – The direction to get a terminal in, as either a direction vector or an angle in radians. Note that the angle is defined as is mathematical standard: measured anticlockwise from the positive horizontal.

Returns:

The terminal on the node in the specified direction.

Return type:

Terminal

get_center() ndarray[tuple[Any, ...], dtype[float64]]

Get the centre of the node.

Note that this is not the geometric centre, but rather the point from which terminals originate (the centre of the node circle/blob).

hide_blob() Self

Make the solder blob invisible.

This will disable autoblobbing, as otherwise there would be two competing sources of truth on whether a blob should be displayed or not.

property left: Terminal

Get the left-pointing terminal of the node, creating it if necessary.

make_filled(reenable_autoblobbing: bool = True) Self

Set the type of the node to filled (a filled solder blob, i.e. circle).

By default, this call will automatically re-enable autoblobbing. To disable this behaviour, use the reenable_autoblobbing parameter.

Parameters:

reenable_autoblobbing (bool) – Whether to re-enable autoblobbing with this call. Defaults to True.

See also

make_open

make_open(make_visible: bool = True) Self

Set the type of the node to open (an empty circle).

Autoblobbing will be automatically disabled by this call. By default, it will also make the node symbol appear (i.e. an unfilled circle), regardless of whether it was showing before. Use the make_visible parameter to adjust this behaviour.

Parameters:

make_visible (bool) – Whether the open node symbol should be forced to become visible by this call. Note that a value of False will not force the node symbol to be invisible, but the symbol will maintain its previous visiblity. Defaults to True.

See also

make_filled

property right: Terminal

Get the right-pointing terminal of the node, creating it if necessary.

set_annotation(annotation: str | Value) Self

Fails for nodes, as they do not have annotations.

set_autoblobbing(autoblob: bool) Self

Specify whether the node should autoblob or not.

If used to enable autoblobbing, an autoblob calculation will be made to decide whether to display the blob or not. Will not have an effect if the node is of an open type.

Parameters:

autoblob (bool) – Whether the node should autoblob or not.

set_blob_visibility(visible: bool) Self

Alter the solder blob visibility.

This will disable autoblobbing, as otherwise there would be two competing sources of truth on whether a blob should be displayed or not.

Parameters:

visible (bool) – Whether the solder blob should be visible.

See also

show_blob, hide_blob

set_label(label: str | Value, direction: ndarray[tuple[Any, ...], dtype[float64]] | float | None = None) Self

Set the label of the node, optionally specifying where it should be.

The direction parameter can be used to specify the position the label should take. If it is left unspecified, the node will identify the most logical position for it (the widest gap between terminals) and keep the label here, with ties being broken by the uppermost position being favoured. This will continue to happen as terminals are added/removed.

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

  • direction (Vector3D | float | None) – The direction in which to place the label. Can either be a direction vector (Vector3D), an angle in radians (float), or None, which signifies that the label should be placed automatically.

show_blob() Self

Make the solder blob visible.

This will disable autoblobbing, as otherwise there would be two competing sources of truth on whether a blob should be displayed or not.

property up: Terminal

Get the up-pointing terminal of the node, creating it if necessary.

property up_left: Terminal

Get the up-left-pointing terminal of the node, creating it if necessary.

property up_right: Terminal

Get the up-right-pointing terminal of the node, creating it if necessary.