DashedLine#

Qualified name: manim.mobject.geometry.line.DashedLine

class DashedLine(*args, dash_length=0.05, dashed_ratio=0.5, **kwargs)[source]#

Bases: Line

A dashed Line.

Parameters:
  • args – Arguments to be passed to Line

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

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

  • kwargs – Additional arguments to be passed to Line

See also

DashedVMobject

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)
        # dashed_ratio decreased
        dashed_3 = DashedLine(config.left_side, config.right_side, dashed_ratio=0.1).shift(DOWN*2)
        self.add(dashed_1, dashed_2, dashed_3)
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)
        # dashed_ratio decreased
        dashed_3 = DashedLine(config.left_side, config.right_side, dashed_ratio=0.1).shift(DOWN*2)
        self.add(dashed_1, dashed_2, dashed_3)

Methods

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 any method of self.

animation_overrides

color

depth

The depth of the mobject.

fill_color

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

height

The height of the mobject.

n_points_per_curve

sheen_factor

stroke_color

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

_original__init__(*args, dash_length=0.05, dashed_ratio=0.5, **kwargs)#

Initialize self. See help(type(self)) for accurate signature.

Parameters:
  • dash_length (float) –

  • dashed_ratio (float) –

Return type:

None

get_end()[source]#

Returns the end point of the line.

Examples

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

Point3D

get_first_handle()[source]#

Returns the point of the first handle.

Examples

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

Point3D

get_last_handle()[source]#

Returns the point of the last handle.

Examples

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

Point3D

get_start()[source]#

Returns the start point of the line.

Examples

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

Point3D