Hi!
In my previous blog posts, we were setting and running our first example animation with the engine called 'Manim'. The example animation only consisted of drawing a square and transforming it into a circle. This time, I want to try out the so called 'WriteStuff' scene in the example_scenes.py. This scene, for the first time, renders a text with cool vector animation that is unique to 3Blue1Brown.What's the problem with the 'WriteStuff' scene?
So, if you try running this command:python extract_scene.py -p example_scenes.py WriteStuff
to preview the WriteStuff scene, you would probably see an error that tells you that there is a .svg file missing. This error is caused by the lack of a framework called 'LaTeX' that is used to convert text to .svg files to be able to render the text with all of the cool animations. LaTeX is mentioned as a primary requirement in the readme file on the official GitHub page of the Manim. So, today we are going to install it and test it.
Installing LaTeX
HERE is a link for the setup file, install it just like any other setup. That simple.
Checking if LaTeX works properly
As Anthony Northrup talks about checking if LaTeX and dvisvgm work (it's a LaTeX tool that converts DVI and EPS files to SVG files, hence the name dvi - svg):Once you've tried to preview/save the WriteStuff scene, you should have a file<NUMBERS>.tex
in the /files/Tex directory. If you ran into issues when viewing the scene, try calling the conversion calls (found at the bottom ofmobject/tex_mobject.py
) manually (but with logging) from the command line. For example:> cd /files/Tex/ > copy "<NUMBERS>.tex" test.tex > latex -halt-on-error test.tex > dvisvgm test.dvi -n -o test.svg
If there aren't any errors at each step, it should convert properly when running via the extract_scenes file, but the dvisvgm might pop an error.
So, what if the dvisvgm pops an error?
With couple of simple steps you would need to replace the existing dvisvgm tool with the most recent version found HERE (you can also compile from the latest source found here). Choose the correct architecture (32 or 64 bit) and download the .zip archive. There, you will find couple of files including dvisvgm.exe.
Now you will need to use this new version instead of the included version from MiKTeX (or whichever LaTeX installation you are using). To do this, we will need to extract the zip to a folder, then add that folder to the system PATH variable. You can find instructions for doing this here. Once that has been added, you can verify the system is pointing to the updated dvisvgm by opening a new command prompt window (you may have to restart on older machines for the PATH variable to be properly updated) and use the where command:
> where dvisvgm
<THE ABSOLUTE PATH(S) OF dvisvgm IF FOUND>
If the folder you extracted the zip to is at the top, you are ready to test again, otherwise you'll need to fix the PATH.
Now, if you try just the last command, it should work properly converting the dvi to svg.
Try running the preview command again and it would hopefully work:
python extract_scene.py -p example_scenes.py WriteStuff
That's it ! You can now render any text you want !
0 comments:
Post a Comment