manim.mobject.geometry.DashedLine

class DashedLine(*args, dash_length=0.05, dash_spacing=None, positive_space_ratio=0.5, **kwargs)[source]

Bases: manim.mobject.geometry.Line

A dashed Line.

Parameters
  • args (Any) – Arguments to be passed to Line

  • dash_length (float, optional) – The length of each individual dash of the line.

  • dash_spacing (Optional[float]) – The spacing between the dashes.

  • positive_space_ratio (float, optional) – The ratio of empty space to dash space. Range of 0-1.

  • kwargs (Any) – Additional arguments to be passed to Line

Examples

Example: DashedLineExample

../_images/DashedLineExample-1.png
from manim import *

class DashedLineExample(Scene):
    def construct(self):
        # dash_length increased
        dashed_1 = DashedLine(config.left_side, config.right_side, dash_length=2.0).shift(UP*2)
        # normal
        dashed_2 = DashedLine(config.left_side, config.right_side)
        # positive_space_ratio decreased
        dashed_3 = DashedLine(config.left_side, config.right_side, positive_space_ratio=0.1).shift(DOWN*2)
        self.add(dashed_1, dashed_2, dashed_3)

See also

DashedVMobject

Methods

calculate_num_dashes

Returns the number of dashes in the dashed line.

calculate_positive_space_ratio

get_end

Returns the end point of the line.

get_first_handle

Returns the point of the first handle.

get_last_handle

Returns the point of the last handle.

get_start

Returns the start point of the line.

Attributes

animate

Used to animate the application of a method.

animation_overrides

depth

The depth of the mobject.

height

The height of the mobject.

width

The width of the mobject.

calculate_num_dashes()[source]

Returns the number of dashes in the dashed line.

Examples

>>> DashedLine().calculate_num_dashes()
20
Return type

int

get_end()[source]

Returns the end point of the line.

Examples

>>> DashedLine().get_end()
array([0.99871795, 0.        , 0.        ])
Return type

numpy.ndarray

get_first_handle()[source]

Returns the point of the first handle.

Examples

>>> DashedLine().get_first_handle()
array([-0.98333333,  0.        ,  0.        ])
Return type

numpy.ndarray

get_last_handle()[source]

Returns the point of the last handle.

Examples

>>> DashedLine().get_last_handle()
array([0.98205128, 0.        , 0.        ])
Return type

numpy.ndarray

get_start()[source]

Returns the start point of the line.

Examples

>>> DashedLine().get_start()
array([-1.,  0.,  0.])
Return type

numpy.ndarray