Line#
Qualified name: manim.mobject.geometry.line.Line
- class Line(start=array([- 1., 0., 0.]), end=array([1., 0., 0.]), buff=0, path_arc=None, **kwargs)[source]#
Bases:
TipableVMobject
Methods
Initializes
points
and therefore the shape.get_angle
Returns the projection of a point onto a line.
get_slope
get_unit_vector
get_vector
Initializes
points
and therefore the shape.Sets starts and end coordinates of a line.
set_angle
set_length
set_path_arc
set_points_by_ends
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.
- generate_points()[source]#
Initializes
points
and therefore the shape.Gets called upon creation. This is an empty method that can be implemented by subclasses.
- get_projection(point)[source]#
Returns the projection of a point onto a line.
- Parameters
point (Sequence[float]) – The point to which the line is projected.
- Return type
Sequence[float]
- init_points()#
Initializes
points
and therefore the shape.Gets called upon creation. This is an empty method that can be implemented by subclasses.
- put_start_and_end_on(start, end)[source]#
Sets starts and end coordinates of a line.
Examples
Example: LineExample ¶
from manim import * class LineExample(Scene): def construct(self): d = VGroup() for i in range(0,10): d.add(Dot()) d.arrange_in_grid(buff=1) self.add(d) l= Line(d[0], d[1]) self.add(l) self.wait() l.put_start_and_end_on(d[1].get_center(), d[2].get_center()) self.wait() l.put_start_and_end_on(d[4].get_center(), d[7].get_center()) self.wait()
- Parameters
start (Sequence[float]) –
end (Sequence[float]) –