JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/two.js/0.7.0-alpha.1/two.js"></script>
<div id="two-container"></div>
CSS
div {
width: 100%;
height: 100%;
}
svg,
canvas {
border: 1px #000 solid;
}
JavaScript
// get a container element to put your instance of two in it
var container = document.getElementById('two-container');
var two = new Two({
width: 300,
height: 300
}).appendTo(container);
// create some shapes with two's built-in methods
var circle = two.makeCircle(100, 150, 50);
var square = two.makeRectangle(200, 150, 50, 50);
// you can then style your shapes in many ways
// two also accepts all valid css color attributes
circle.fill = '#abcdef';
circle.noStroke();
circle.opacity = 0.5;
square.noFill();
square.linewidth = 5;
square.stroke = 'orangered';
// then you need to tell two to render everything
two.update();