git @ Cat's Eye Technologies Semicircle-Jam / master demo / semicircle-jam-launcher.js
master

Tree @master (Download .tar.gz)

semicircle-jam-launcher.js @masterraw · history · blame

// SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
// For more information, please refer to <https://unlicense.org/>
// SPDX-License-Identifier: Unlicense

// dam-plus-widgets-0.2.js and semicircle-jam.js should be loaded before this.
// After this is loaded, call launch() to start the gewgaw.

function launch(config) {
  var div=DAM.maker('div'), button=DAM.maker('button'), canvas=DAM.maker('canvas');

  var gewgaw = new SemicircleJam();

  var can = canvas({ width: 500, height: 500 });
  config.container.appendChild(can);

  var controlPanel = div(
    div(
      button("Restart", {
        onclick: function() {
          gewgaw.reset();
        }
      }),
      button("Carry on", {
        onclick: function() {
          gewgaw.go();
        }
      }),
      button("Close loop", {
        onclick: function() {
          gewgaw.closeLoop();
        }
      })
    )
  );
  config.container.appendChild(controlPanel);

  gewgaw.init({
    'canvas': can
  });
}