kilacoda / chanim

Animation engine for explanatory chemistry videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hatched bonds

Luis-Henrique655 opened this issue · comments

I was trying to make some molecules and I noticed that hatched bonds show up as normal bonds

class Methane(Scene):
def construct(self):
f1 = ChemObject("C(-[5]H)(-[2]H)(<[:-70]H)(<:[:-20]H)")
self.play(Write(f1))
self.wait()

Methane (1)

also I'm having some trouble trying to change the color of bonds and atoms

class Chem2(Scene):
def construct(self):
f1 = ChemObject("-[:30]=[:-30,,,,red]-[:30]")
self.play(Write(f1))
self.wait()

Chem2

Does anyone know what am I doing wrong?

Hi, really sorry for a late response.

I looked into it and can confirm that the hatched bonds do in fact not show up.The SVG produced by TeX looks fine though:
image
I'm assuming this is a problem with Manim's SVG parser which already has quite a few problems. I'm sorry but I don't think there's anything I can do about this at the moment.

Regarding the colors, Manim flushes out all colors except black and white in SVGs. There is a workaround though:

        self.add(f1,get_submobject_index_labels(f1[0])) ## shows the indexes of each part of the molecule.

Result:
image

        ## you can remove the previous line if you want to
        f1[0][1:3].set_color(RED)
        self.add(f1)

Result:
image

Hope this helps. Once again, sorry for a late response.