Manim extension for making chemistry videos
Project description
Chanim
This is an extension to 3BlueBrown's Manim library, for making videos regarding chemistry.
Installation
- Get manim as described here according to your OS, or
pip install manim
. You'll have to download other required modules as explained at the manim docs page. - Clone the contents of this repository.
- Open a terminal in the cloned directory and run
pip install -e .
(note: requirespip
to be installed, see how to install for your OS)
That's about it. You can now do from chanim import <*|object_name>
like any regular Python package.
Usage
from chanim import *
class MoleculeOrReaction(Scene):
<name> = ChemObject(<chemfig code>)
self.play(Write(<name>))
Type this into a python (.py
) file (changing whatever's necessary, i.e. stuff inside the angle brackets). I'll assume you named it chem.py
In your command prompt/terminal write this (assuming you're in your project directory):
manim chem.py MoleculeOrReaction -pl
This'll render your Scene and preview it in your default player (in 'l'ow quality).
Here's a little example of it working.
from chanim import *
class ChanimScene(Scene):
def construct(self):
chem = ChemWithName("*6((=O)-N(-CH_3)-*5(-N=-N(-CH_3)-=)--(=O)-N(-H_3C)-)")
self.play(chem.creation_anim())
self.wait()
Congrats! You've written and played your first animation (or "chanimation" should I say)
Explore the code and docs (not written yet) for more on how to use chanim.
Abilities
Currently chanim only supports drawing compounds and reactions along with a few chemfig commands (such as coordinate bonds and complexes etc.) but more is to come! If you have a suggestion, file an issue with a proper tag.
A Quick Note
There may be some faulty code and a lot of this may not be well made/documented. Feel free to file an issue if something doesn't work properly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.