This repository has been archived by the owner. It is now read-only.
A lightweight library for parametric design
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
example
src
.gitattributes
.gitignore
.npmignore
CHANGELOG.md
LICENSE
README.md
ROADMAP.md
bower.json
gulpfile.js
package.json

README.md

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:

<head>
  ...
  <script src="draft.js/dist/draft.min.js"></script>
</head>
<body>
  <div id="view" style="width: 100%; height: 100%"></div>
</body>

Write a new script and include it after your html content:

// Create a new draft document and add a group to it
var doc = draft('my_document');
var group = doc.group();

// Add some shapes to the group
var rect = group.rect(200, 150).fill('#18f');
var circle = group.circle(50).fill('#f1c');

// Create a view for the group
var view = group.view(600, 400);

// Use the draft-svg plugin to render an image
var body = document.getElementById('body');
body.appendChild(view.svg());

Plugins

Contributing

Acknowledgements