JSFiddle - React, Tailwind, and code Playground

by ZhenLiu

HTML

<div id="drawing"></div>

JavaScript

function drawSomething(drawArea, x, y) {
	// because we are setting innerDraw as nested, the shapes inside this area will be grouped together & treated as one entity.
  var innerDraw = drawArea.nested();
  innerDraw.rect(50,50).move(x,y).fill('#f00');
  innerDraw.circle(50).cx(x).cy(y);
  // very important to return the result of this drawing!
  return innerDraw;
}