<body> <divid="container"></div> <inputtype="button"id="button"value="Add random shape" /> <script> var width = window.innerWidth; var height = window.innerHeight;
var stage = new Konva.Stage({ container: 'container', width: width, height: height });
var layer = new Konva.Layer(); stage.add(layer);
var group = new Konva.Group({ x: 50, y: 50, draggable: true }); layer.add(group);
// create new transformer var tr = new Konva.Transformer(); layer.add(tr); tr.attachTo(group); layer.draw();