Node¶
- class manim_eng.components.node.Node(open_: bool = False, autoblob: bool = True, **kwargs: Any)¶
Bases:
ComponentNode in a circuit and open/filled terminal circuit symbol.
Nodehandles 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.animateUsed to animate the application of any method of
self.Node.animation_overridesNode.colorNode.depthThe depth of the mobject.
Get the down-pointing terminal of the node, creating it if necessary.
Get the down-left-pointing terminal of the node, creating it if necessary.
Get down-right-pointing terminal of the node, creating it if necessary.
Node.fill_colorIf there are multiple colors (for gradient) this returns the first one
Node.heightThe height of the mobject.
Get the left-pointing terminal of the node, creating it if necessary.
Node.n_points_per_curveGet the right-pointing terminal of the node, creating it if necessary.
Node.sheen_factorNode.stroke_colorNode.terminalsThe list of terminals of the component.
Get the up-pointing terminal of the node, creating it if necessary.
Get the up-left-pointing terminal of the node, creating it if necessary.
Get the up-right-pointing terminal of the node, creating it if necessary.
Node.widthThe 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 baseComponentclass 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.
See also
- 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.
See also
- 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:
- 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.
See also
- 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_autoblobbingparameter.- Parameters:
reenable_autoblobbing (bool) – Whether to re-enable autoblobbing with this call. Defaults to
True.
See also
- 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_visibleparameter 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
Falsewill not force the node symbol to be invisible, but the symbol will maintain its previous visiblity. Defaults toTrue.
See also
- 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.
See also
- 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.
- 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
directionparameter 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
Valueto 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), orNone, 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.
See also