draft.js
inspired by SVG.js
draft.js is a lightweight library for parametric design.
draft.js is licensed under the terms of the MIT License.
Installation
Prebuilt distributions can be found on the releases page.
You can also use Bower
or npm
:
# Install via Bower bower install draft.js # Install via npm npm install draft.js
Documentation
Guides and API reference are located in the docs directory and on the wiki page.
Getting Started
Include the library at the top of your html file:
...
Write a new script and include it after your html content:
// Create a new draft document and add a group to itvar doc = ;var group = doc; // Add some shapes to the groupvar rect = group;var circle = group; // Create a view for the groupvar view = group; // Use the draft-svg plugin to render an imagevar body = document;body;
Plugins
Contributing
- Follow the Google JavaScript Style Guide
- Indent with two spaces
- Use semicolons at the ends of lines
Acknowledgements
- Wout Fierens, Ulrich-Matthias Schäfer, and all the other contributors to the SVG.js library.
- Oliver Caldwell for creating EventEmitter, a library for using DOM-like events without the DOM, and Heir, a tiny script for object inheritance and mixins.