#!/usr/bin/env python


from manim import *

# To watch one of these scenes, run the following:
# python --quality m manim -p example_scenes.py SquareToCircle
#
# Use the flag --quality l for a faster rendering at a lower quality.
# Use -s to skip to the end and just save the final frame
# Use the -p to have preview of the animation (or image, if -s was
# used) pop up once done.
# Use -n <number> to skip ahead to the nth animation of a scene.
# Use -r <number> to specify a resolution (for example, -r 1920,1080
# for a 1920x1080 video)


class OpeningManim(Scene):
    def construct(self):
        title = Tex(r"This is some \LaTeX")
        basel = MathTex(r"\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}")
        VGroup(title, basel).arrange(DOWN)
        self.play(
            Write(title),
            FadeIn(basel, shift=DOWN),
        )
        self.wait()

        transform_title = Tex("That was a transform")
        transform_title.to_corner(UP + LEFT)
        self.play(
            Transform(title, transform_title),
            LaggedStart(*(FadeOut(obj, shift=DOWN) for obj in basel)),
        )
        self.wait()

        grid = NumberPlane()
        grid_title = Tex("This is a grid", font_size=72)
        grid_title.move_to(transform_title)

        self.add(grid, grid_title)  # Make sure title is on top of grid
        self.play(
            FadeOut(title),
            FadeIn(grid_title, shift=UP),
            Create(grid, run_time=3, lag_ratio=0.1),
        )
        self.wait()

        grid_transform_title = Tex(
            r"That was a non-linear function \\ applied to the grid",
        )
        grid_transform_title.move_to(grid_title, UL)
        grid.prepare_for_nonlinear_transform()
        self.play(
            grid.animate.apply_function(
                lambda p: p
                + np.array(
                    [
                        np.sin(p[1]),
                        np.sin(p[0]),
                        0,
                    ],
                ),
            ),
            run_time=3,
        )
        self.wait()
        self.play(Transform(grid_title, grid_transform_title))
        self.wait()


class SquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        square = Square()
        square.flip(RIGHT)
        square.rotate(-3 * TAU / 8)
        circle.set_fill(PINK, opacity=0.5)

        self.play(Create(square))
        self.play(Transform(square, circle))
        self.play(FadeOut(square))


class WarpSquare(Scene):
    def construct(self):
        square = Square()
        self.play(
            ApplyPointwiseFunction(
                lambda point: complex_to_R3(np.exp(R3_to_complex(point))),
                square,
            ),
        )
        self.wait()


class WriteStuff(Scene):
    def construct(self):
        example_text = Tex("This is a some text", tex_to_color_map={"text": YELLOW})
        example_tex = MathTex(
            "\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}",
        )
        group = VGroup(example_text, example_tex)
        group.arrange(DOWN)
        group.width = config["frame_width"] - 2 * LARGE_BUFF

        self.play(Write(example_text))
        self.play(Write(example_tex))
        self.wait()


class UpdatersExample(Scene):
    def construct(self):
        decimal = DecimalNumber(
            0,
            show_ellipsis=True,
            num_decimal_places=3,
            include_sign=True,
        )
        square = Square().to_edge(UP)

        decimal.add_updater(lambda d: d.next_to(square, RIGHT))
        decimal.add_updater(lambda d: d.set_value(square.get_center()[1]))
        self.add(square, decimal)
        self.play(
            square.animate.to_edge(DOWN),
            rate_func=there_and_back,
            run_time=5,
        )
        self.wait()


class SpiralInExample(Scene):
    def construct(self):
        logo_green = "#81b29a"
        logo_blue = "#454866"
        logo_red = "#e07a5f"

        font_color = "#ece6e2"

        pi = MathTex(r"\pi").scale(7).set_color(font_color)
        pi.shift(2.25 * LEFT + 1.5 * UP)

        circle = Circle(color=logo_green, fill_opacity=0.7, stroke_width=0).shift(LEFT)
        square = Square(color=logo_blue, fill_opacity=0.8, stroke_width=0).shift(UP)
        triangle = Triangle(color=logo_red, fill_opacity=0.9, stroke_width=0).shift(
            RIGHT
        )
        pentagon = Polygon(
            *[
                [np.cos(2 * np.pi / 5 * i), np.sin(2 * np.pi / 5 * i), 0]
                for i in range(5)
            ],
            color=PURPLE_B,
            fill_opacity=1,
            stroke_width=0
        ).shift(UP + 2 * RIGHT)
        shapes = VGroup(triangle, square, circle, pentagon, pi)
        self.play(SpiralIn(shapes, fade_in_fraction=0.9))
        self.wait()
        self.play(FadeOut(shapes))


Triangle.set_default(stroke_width=20)


class LineJoints(Scene):
    def construct(self):
        t1 = Triangle()
        t2 = Triangle(line_join=LineJointType.ROUND)
        t3 = Triangle(line_join=LineJointType.BEVEL)

        grp = VGroup(t1, t2, t3).arrange(RIGHT)
        grp.set(width=config.frame_width - 1)

        self.add(grp)


# See many more examples at https://docs.manim.community/en/stable/examples.html

example_scenes/basic.py
#!/usr/bin/env python


from manim import *

# To watch one of these scenes, run the following:
# python --quality m manim -p example_scenes.py SquareToCircle
#
# Use the flag --quality l for a faster rendering at a lower quality.
# Use -s to skip to the end and just save the final frame
# Use the -p to have preview of the animation (or image, if -s was
# used) pop up once done.
# Use -n <number> to skip ahead to the nth animation of a scene.
# Use -r <number> to specify a resolution (for example, -r 1920,1080
# for a 1920x1080 video)


class OpeningManim(Scene):
    def construct(self):
        title = Tex(r"This is some \LaTeX")
        basel = MathTex(r"\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}")
        VGroup(title, basel).arrange(DOWN)
        self.play(
            Write(title),
            FadeIn(basel, shift=DOWN),
        )
        self.wait()

        transform_title = Tex("That was a transform")
        transform_title.to_corner(UP + LEFT)
        self.play(
            Transform(title, transform_title),
            LaggedStart(*(FadeOut(obj, shift=DOWN) for obj in basel)),
        )
        self.wait()

        grid = NumberPlane()
        grid_title = Tex("This is a grid", font_size=72)
        grid_title.move_to(transform_title)

        self.add(grid, grid_title)  # Make sure title is on top of grid
        self.play(
            FadeOut(title),
            FadeIn(grid_title, shift=UP),
            Create(grid, run_time=3, lag_ratio=0.1),
        )
        self.wait()

        grid_transform_title = Tex(
            r"That was a non-linear function \\ applied to the grid",
        )
        grid_transform_title.move_to(grid_title, UL)
        grid.prepare_for_nonlinear_transform()
        self.play(
            grid.animate.apply_function(
                lambda p: p
                + np.array(
                    [
                        np.sin(p[1]),
                        np.sin(p[0]),
                        0,
                    ],
                ),
            ),
            run_time=3,
        )
        self.wait()
        self.play(Transform(grid_title, grid_transform_title))
        self.wait()


class SquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        square = Square()
        square.flip(RIGHT)
        square.rotate(-3 * TAU / 8)
        circle.set_fill(PINK, opacity=0.5)

        self.play(Create(square))
        self.play(Transform(square, circle))
        self.play(FadeOut(square))


class WarpSquare(Scene):
    def construct(self):
        square = Square()
        self.play(
            ApplyPointwiseFunction(
                lambda point: complex_to_R3(np.exp(R3_to_complex(point))),
                square,
            ),
        )
        self.wait()


class WriteStuff(Scene):
    def construct(self):
        example_text = Tex("This is a some text", tex_to_color_map={"text": YELLOW})
        example_tex = MathTex(
            "\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}",
        )
        group = VGroup(example_text, example_tex)
        group.arrange(DOWN)
        group.width = config["frame_width"] - 2 * LARGE_BUFF

        self.play(Write(example_text))
        self.play(Write(example_tex))
        self.wait()


class UpdatersExample(Scene):
    def construct(self):
        decimal = DecimalNumber(
            0,
            show_ellipsis=True,
            num_decimal_places=3,
            include_sign=True,
        )
        square = Square().to_edge(UP)

        decimal.add_updater(lambda d: d.next_to(square, RIGHT))
        decimal.add_updater(lambda d: d.set_value(square.get_center()[1]))
        self.add(square, decimal)
        self.play(
            square.animate.to_edge(DOWN),
            rate_func=there_and_back,
            run_time=5,
        )
        self.wait()


class SpiralInExample(Scene):
    def construct(self):
        logo_green = "#81b29a"
        logo_blue = "#454866"
        logo_red = "#e07a5f"

        font_color = "#ece6e2"

        pi = MathTex(r"\pi").scale(7).set_color(font_color)
        pi.shift(2.25 * LEFT + 1.5 * UP)

        circle = Circle(color=logo_green, fill_opacity=0.7, stroke_width=0).shift(LEFT)
        square = Square(color=logo_blue, fill_opacity=0.8, stroke_width=0).shift(UP)
        triangle = Triangle(color=logo_red, fill_opacity=0.9, stroke_width=0).shift(
            RIGHT
        )
        pentagon = Polygon(
            *[
                [np.cos(2 * np.pi / 5 * i), np.sin(2 * np.pi / 5 * i), 0]
                for i in range(5)
            ],
            color=PURPLE_B,
            fill_opacity=1,
            stroke_width=0
        ).shift(UP + 2 * RIGHT)
        shapes = VGroup(triangle, square, circle, pentagon, pi)
        self.play(SpiralIn(shapes, fade_in_fraction=0.9))
        self.wait()
        self.play(FadeOut(shapes))


Triangle.set_default(stroke_width=20)


class LineJoints(Scene):
    def construct(self):
        t1 = Triangle()
        t2 = Triangle(joint_type=LineJointType.ROUND)
        t3 = Triangle(joint_type=LineJointType.BEVEL)

        grp = VGroup(t1, t2, t3).arrange(RIGHT)
        grp.set(width=config.frame_width - 1)

        self.add(grp)


# See many more examples at https://docs.manim.community/en/stable/examples.html

example_scenes/basic.py
diff --git a/example_scenes/basic.py b/example_scenes/basic.py
index cf5f475223..e61ae01f67 100644
--- a/example_scenes/basic.py
+++ b/example_scenes/basic.py
@@ -167,8 +167,8 @@ def construct(self):
 class LineJoints(Scene):
     def construct(self):
         t1 = Triangle()
-        t2 = Triangle(line_join=LineJointType.ROUND)
-        t3 = Triangle(line_join=LineJointType.BEVEL)
+        t2 = Triangle(joint_type=LineJointType.ROUND)
+        t3 = Triangle(joint_type=LineJointType.BEVEL)
 
         grp = VGroup(t1, t2, t3).arrange(RIGHT)
         grp.set(width=config.frame_width - 1)

keyword argument 'line_join'
## Description of bug / unexpected behavior
When I rendering the line joint scene from basic.py from the example scene it shows Mobject.__init__() got an unexpected keyword argument 'line_join'

## How to reproduce the issue
<!-- Provide a piece of code illustrating the undesired behavior. -->

<details><summary>Code for reproducing the problem</summary>

```py
class LineJoints(Scene):
    def construct(self):
        t1 = Triangle()
        t2 = Triangle(line_join=LineJointType.ROUND)
        t3 = Triangle(line_join=LineJointType.BEVEL)

        grp = VGroup(t1, t2, t3).arrange(RIGHT)
        grp.set(width=config.frame_width - 1)

        self.add(grp)
```

</details>

## Logs
<details><summary>Virtual Code Studio output</summary>
<!-- Add "-v DEBUG" when calling manim to generate more detailed logs -->

```
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\tools\Manim\Lib\site-packages\manim\cli\render\commands.py:115 in render                      │
│                                                                                                  │
│   112 │   │   │   try:                                                                           │
│   113 │   │   │   │   with tempconfig({}):                                                       │
│   114 │   │   │   │   │   scene = SceneClass()                                                   │
│ ❱ 115 │   │   │   │   │   scene.render()                                                         │
│   116 │   │   │   except Exception:                                                              │
│   117 │   │   │   │   error_console.print_exception()                                            │
│   118 │   │   │   │   sys.exit(1)                                                                │
│                                                                                                  │
│ C:\tools\Manim\Lib\site-packages\manim\scene\scene.py:223 in render                              │
│                                                                                                  │
│    220 │   │   """                                                                               │
│    221 │   │   self.setup()                                                                      │
│    222 │   │   try:                                                                              │
│ ❱  223 │   │   │   self.construct()                                                              │
│    224 │   │   except EndSceneEarlyException:                                                    │
│    225 │   │   │   pass                                                                          │
│    226 │   │   except RerunSceneException as e:                                                  │
│                                                                                                  │
│ C:\Users\HP\Documents\ManimCE\basic.py:170 in construct                                          │
│                                                                                                  │
│   167 class LineJoints(Scene):                                                                   │
│   168 │   def construct(self):                                                                   │
│   169 │   │   t1 = Triangle()                                                                    │
│ ❱ 170 │   │   t2 = Triangle(line_join=LineJointType.ROUND)                                       │
│   171 │   │   t3 = Triangle(line_join=LineJointType.BEVEL)                                       │
│   172 │   │                                                                                      │
│   173 │   │   grp = VGroup(t1, t2, t3).arrange(RIGHT)                                            │
│                                                                                                  │
│ C:\tools\Manim\Lib\site-packages\manim\mobject\geometry\polygram.py:559 in __init__              │
│                                                                                                  │
│   556 │   """                                                                                    │
│   557 │                                                                                          │
│   558 │   def __init__(self, **kwargs):                                                          │
│ ❱ 559 │   │   super().__init__(n=3, **kwargs)                                                    │
│   560                                                                                            │
│   561                                                                                            │
│   562 class Rectangle(Polygon):                                                                  │
│                                                                                                  │
│ C:\tools\Manim\Lib\site-packages\manim\mobject\geometry\polygram.py:428 in __init__              │
│                                                                                                  │
│   425 │   """                                                                                    │
│   426 │                                                                                          │
│   427 │   def __init__(self, n: int = 6, **kwargs):                                              │
│ ❱ 428 │   │   super().__init__(n, density=1, **kwargs)                                           │
│   429                                                                                            │
│   430                                                                                            │
│   431 class Star(Polygon):                                                                       │
│                                                                                                  │
│ C:\tools\Manim\Lib\site-packages\manim\mobject\geometry\polygram.py:399 in __init__              │
│                                                                                                  │
│   396 │   │   │                                                                                  │
│   397 │   │   │   vertex_groups.append(group)                                                    │
│   398 │   │                                                                                      │
│ ❱ 399 │   │   super().__init__(*vertex_groups, **kwargs)                                         │
│   400                                                                                            │
│   401                                                                                            │
│   402 class RegularPolygon(RegularPolygram):                                                     │
│                                                                                                  │
│ C:\tools\Manim\Lib\site-packages\manim\mobject\geometry\polygram.py:69 in __init__               │
│                                                                                                  │
│    66 │   """                                                                                    │
│    67 │                                                                                          │
│    68 │   def __init__(self, *vertex_groups: Iterable[Sequence[float]], color=BLUE, **kwargs):   │
│ ❱  69 │   │   super().__init__(color=color, **kwargs)                                            │
│    70 │   │                                                                                      │
│    71 │   │   for vertices in vertex_groups:                                                     │
│    72 │   │   │   first_vertex, *vertices = vertices                                             │
│                                                                                                  │
│ C:\tools\Manim\Lib\site-packages\manim\mobject\types\vectorized_mobject.py:125 in __init__       │
│                                                                                                  │
│    122 │   │   self.shade_in_3d = shade_in_3d                                                    │
│    123 │   │   self.tolerance_for_point_equality = tolerance_for_point_equality                  │
│    124 │   │   self.n_points_per_cubic_curve = n_points_per_cubic_curve                          │
│ ❱  125 │   │   super().__init__(**kwargs)                                                        │
│    126 │   │                                                                                     │
│    127 │   │   if fill_color:                                                                    │
│    128 │   │   │   self.fill_color = fill_color                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: Mobject.__init__() got an unexpected keyword argument 'line_join'
```
</details>

<details><summary>CMD output</summary>
Traceback (most recent call last):
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\numpy\core\__init__.py", line 24, in <module>
    from . import multiarray
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\numpy\core\multiarray.py", line 10, in <module>
    from . import overrides
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\numpy\core\overrides.py", line 8, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\numpy\__init__.py", line 158, in <module>
    from numpy.__config__ import show as show_config
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\numpy\__config__.py", line 4, in <module>
    from numpy.core._multiarray_umath import (
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\numpy\core\__init__.py", line 50, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.11 from "C:\Users\HP\Documents\ManimCE\mce\Scripts\python.exe"
  * The NumPy version is: "1.26.0"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\HP\Documents\ManimCE\mce\Scripts\manim.exe\__main__.py", line 4, in <module>
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\manim\__init__.py", line 17, in <module>
    from ._config import *
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\manim\_config\__init__.py", line 10, in <module>
    from .utils import ManimConfig, ManimFrame, make_config_parser
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\manim\_config\utils.py", line 27, in <module>
    import numpy as np
  File "C:\Users\HP\Documents\ManimCE\mce\Lib\site-packages\numpy\__init__.py", line 163, in <module>
    raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.
</details>

## System specifications

<details><summary>System Details</summary>

- OS Windows 10
- Python version (3.11.5)


