2

I started learning manim and I hope you could help me understand how this code works

class Line_1(Scene):
    def construct(self):
        path = Line(LEFT*5,RIGHT*5,stroke_opatity=0.5)
        path.points[1:3] += UP*2
        self.add(path)

When I run the code I get this: enter image description here

However I do not know how to interpret this "path.points[1:3] += UP*2" What does it mean .points[1:3]?

Thanks in advance

  • 2
    Does this answer your question? [Understanding slice notation](https://stackoverflow.com/questions/509211/understanding-slice-notation) – Random Davis Sep 21 '20 at 21:03

1 Answers1

2

All VMobjects (Lines, Circles, etc) are Bezier curves, and all Bezier curves have control points, those control points are in the .points attribute, the lines have 4 control points, and what that code does is to move the intermediate control points (I do not move the ends).

TheoremOfBeethoven
  • 1,864
  • 6
  • 15