kilacoda / chanim

Animation engine for explanatory chemistry videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bonds not displayed

alexander-schoch-github opened this issue · comments

After compiling

class tikz(Scene):
    def construct(self):
        testobject = ChemObject("-[:30](=[2]O)-[:30]OH")
        self.play(Write(testobject))
        self.wait(3)

the resulting image looks like compiled by pure manim:

aceticacid

Works for me though:
tikz
Could you show the .tex file, please?

Of course I forgot the minus sign...

corresponding .tex-file:

\documentclass[preview]{standalone}

\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{setspace}
\usepackage{tipa}
\usepackage{relsize}
\usepackage{textcomp}
\usepackage{mathrsfs}
\usepackage{calligra}
\usepackage{wasysym}
\usepackage{ragged2e}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{microtype}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.geometric}
\usepackage{chemfig}
\usepackage{mhchem}
\DisableLigatures{encoding = *, family = * }
%\usepackage[UTF8]{ctex}
\linespread{1}

\begin{document}

\begin{align*}
\setchemfig{atom sep = 2em}
\chemfig{-[:30](=[2]O)-[:-30]OH}
\end{align*}

\end{document}

I don't see anything wrong with it at a short glance.

Update: After some messing around, I found out that the compilation from .dvi to .svg failed. This issue could be resolved by using \documentclass[preview,dvisvgm]{standalone} in the preamble. Now, the .svg file is generated correctly.

However, afterwards, this .svg file is not inserted into the video/image correctly, as seen here (code below):

ExampleTikz

This appears to be a general manim problem, though, which is why I opened an issue on 3b1b/manim.

As this problem does not occur in your case, I am assuming that it only happens on linux-based operating systems.

Code for image above:

from manimlib.imports import *

class TikzMobject(TextMobject):
    CONFIG = {
        "stroke_width": 3,
        "fill_opacity": 0,
        "stroke_opacity": 1,
    }

class ExampleTikz(Scene):
    def construct(self):
        circuit = TikzMobject(r"""
            \begin{tikzpicture}
                \draw (0,0) -- (1,0);
                \node at (1,0) {sometext};
            \end{tikzpicture}
            """
            )
        self.play(Write(circuit))
        self.wait()