Giter Club home page Giter Club logo

molvwr's Introduction

Molvwr

This project is a WebGL molecule viewer made with Babylon.js.

While the main purpose is to have fun with WebGL and Babylon.js, the end goal is to provide a simple component to embed 3D molecules in your website.

Have a look at our demo website. We have examples for a rich molecule catalog, or an example of how to embed Molvwr in your website.

Supported molecule file formats

Molvwr supports "xyz", "mol", "sdf", and "pdb" files. If you want an additional file format, please fill an issue

How to embed Molvwr in your website

You could look at the sample page and use F12 developper tools to look at the source. Here is a brief summary.

Embedding Molvwr into your site is very easy. The most simple way is to add the script "molvwr-bundle.js" to your page, just like this:

<script src="lib/molvwr-bundle.js"></script>

This script contains a bundle of Molvwr, Babylon.js (a WebGL 3D Engine) and hand.js (a polyfill for pointer events that enables touch interaction).
You could also add the different files separately if you would like to use Babylon somewhere else in your site.

When your script is ready, add a bloc in your page with a "data-molvwr" attribute containing the path of your molecule file :

<div class="mol mol-left" data-molvwr="mol.sdf"></div>

Now you just need to call "Molvwr.process()" to have your bloc turning into a 3D molecule

<script type="text/javascript">
  document.addEventListener("DOMContentLoaded", function() {
    Molvwr.process();
  });
</script>

The "process" function can be called without parameters, or you could explicitely provide an HTML element (or an array of elements).

Advanced integration

If you want to go deep into the rabbit hole, you could work with Molvwr in advanced ways. It has been designed to be extensible and to tweek rendering if you would like. We will expand documentation in the near future but for now, you could have a look at the source code, and the molecule catalog sample to get an idea.

molvwr's People

Contributors

gleborgne avatar

Watchers

James Cloos avatar Kaoru Kure avatar

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.