This repository serves as a guide to help developers understand and utilize the Mol* code effectively. This gallery aims to provide clear, concise, and practical examples.
To get started with the Mol* gallery examples, you can try them out in CodeSandbox, run them locally, or use a prebuilt example.
From a browser, use one of the links below to open a code example in CodeSandbox. This web-application executes the package scripts in a virtual machine to create the application bundle and serve it online, in a preview tab.
The code example can be downloaded as a zip file and executed locally (cf.infra).
You can also sign-in to CodeSandbox and edit the code online using a VS-code interface with code hints and an automatic preview of the changes. Your changes can be saved to your own account.
From the terminal, navigate to the root of an example directory (ex: ./default/
). This directory must contain a package.json
file. Execute the following commands
# install dependencies
npm install
# run the bundler and start the local development server.
npm run start
Once the development server has started and return a local url for the preview.
These examples rely on a prebuilt bundle js file that exports the functions required to make the example work. This technique enables standalone HTML pages that can be run directly from the local file system. The js script content can also be used directly in online editors such as CodePen that can not build bundles.
- See
prebuilt_examples/gallery/example.html
for basic usage - To expose other functions from Mol*, make changes to the
prebuilt_examples/src
folder, and rebuild the supporting library using
# install dependencies
npm install
# build the gallery.js file
npm run build
# or watch for development
npm run watch
- For usage in CodePen, use https://www.jsdelivr.com for
prebuilt_examples/gallery/js/index.js
withAdd External Script
:
- Selections
- Representation
- Camera
- Coloring
- IO
- Default
- Minimal example
- Representation