ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
20.06k stars 1.48k forks source link

Unable to Render Some Example Scenes #991

Closed tinfungster closed 3 years ago

tinfungster commented 3 years ago

This is the first time I ever reported an issue, so I hope I wrote it well.

Description of bug / unexpected behavior

I rendered the example_scenes.py file that I copied from 3b1b's Manim.

Expected behavior

I expected both scenes to work because I did modify the code the first line by changing manimlib.imports to manim and Theorem of Beethoven said that Manim Community was quite similar to Grant's version of Manim. However, I could only run the SquareToCircle Scene and I could not run the WriteStuff animation. The terminal said that Frame_Width was not defined.

How to reproduce the issue

I copied the example_scenes.py from 3b1b's Manim at https://github.com/3b1b/manim . Then I rendered two different Scenes: SquareToCircle and WriteStuff. I rendered the scenes like this.

This is exactly what the terminal said: Traceback (most recent call last): File "/Users/tinlongfung/opt/anaconda3/lib/python3.8/site-packages/manim/main.py", line 94, in main scene.render() File "/Users/tinlongfung/opt/anaconda3/lib/python3.8/site-packages/manim/scene/scene.py", line 169, in render self.construct() File "/Users/tinlongfung/Documents/Code/ManimEnv/manim_ce/example_scenes.py", line 109, in construct group.set_width(FRAME_WIDTH - 2 * LARGE_BUFF) NameError: name 'FRAME_WIDTH' is not defined

#!/usr/bin/env python from manim import * class OpeningManimExample(Scene): def construct(self): title = TextMobject("This is some \\LaTeX") basel = TexMobject( "\\sum_{n=1}^\\infty " "\\frac{1}{n^2} = \\frac{\\pi^2}{6}" ) VGroup(title, basel).arrange(DOWN) self.play( Write(title), FadeInFrom(basel, UP), ) self.wait() transform_title = TextMobject("That was a transform") transform_title.to_corner(UP + LEFT) self.play( Transform(title, transform_title), LaggedStart(*map(FadeOutAndShiftDown, basel)), ) self.wait() grid = NumberPlane() grid_title = TextMobject("This is a grid") grid_title.scale(1.5) grid_title.move_to(transform_title) self.add(grid, grid_title) # Make sure title is on top of grid self.play( FadeOut(title), FadeInFromDown(grid_title), ShowCreation(grid, run_time=3, lag_ratio=0.1), ) self.wait() grid_transform_title = TextMobject( "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.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(ShowCreation(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 = TextMobject( "This is some text", tex_to_color_map={"text": YELLOW} ) example_tex = TexMobject( "\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}", ) group = VGroup(example_text, example_tex) group.arrange(DOWN) group.set_width(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.to_edge, DOWN, rate_func=there_and_back, run_time=5, ) self.wait() # See old_projects folder for many, many more ```py Paste your code here. ```

Additional media files

Images/GIFs

Logs

Terminal output ``` PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR ```

System specifications

System Details - OS (with version, e.g Windows 10 v2004 or macOS 10.15 (Catalina)): - RAM: - Python version (`python/py/python3 --version`): - Installed modules (provide output from `pip list`): ``` PASTE HERE ```
LaTeX details + LaTeX distribution (e.g. TeX Live 2020): + Installed LaTeX packages:
FFMPEG Output of `ffmpeg -version`: ``` PASTE HERE ```

Additional comments

I hope you understand what the error is. Could you please explain how I could fix this problem? Thank you!

kilacoda-old commented 3 years ago

Yeah, they probably won't work. A lot has changed between 3b1b/manim and ManimCE in the past few months. We have our own example scenes at example_scenes/basic.py, they should work.

tinfungster commented 3 years ago

Thank you for replying!