Git Product home page Git Product logo

chanim's Introduction

Chanim

This is an extension to Manim library (initially created by 3Blue1Brown), for making videos regarding chemistry.

A Hindi version of this README is available here.

A Chinese version of this README is available here.

Installation (pip)

pip install chanim

Installation (Source)

  1. Install the external dependencies for manim as described here according to your OS.
  2. Clone the contents of this repository.
  3. Open a terminal in the cloned directory and run pip install -e ., or if you prefer to use poetry instead, poetry install. This'll install manim for you as well if you don't already have it installed. (you'll still need to setup the external dependencies though)

That's about it. You can now do from chanim import <*|object_name> like any regular Python package.

Usage

Here's a little example of it working.

from chanim import *

class ChanimScene(Scene):
    def construct(self):
        ## ChemWithName creates a chemical diagram with a name label
        chem = ChemWithName("*6((=O)-N(-CH_3)-*5(-N=-N(-CH_3)-=)--(=O)-N(-H_3C)-)", "Caffeine")

        self.play(chem.creation_anim())
        self.wait()

Type this into a python (.py) file. I'll assume you named it chem.py

In your command prompt/terminal write this (assuming you're in your project directory):

manim -p -qm chem.py ChanimScene

This'll render your Scene and preview it in your default player (in medium quality).

ChanimScene.mp4

Congrats! You've written and played your first animation with chanim (or "chanimation" should I say)

Explore the code and docs (coming soon!) for more on how to use chanim.

Abilities

Currently chanim only supports drawing compounds and reactions along with a few chemfig commands (Chemfig is a latex package that can draw chemical molecules and is used by chanim internally. The documentation is available here) 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.