public void run() {
    animation.trigger();

    if (animation.shouldIncrement()) {

      Selection selection = window.getSelection();

      // Override the default duration
      if (selection != null) {
        animation.setDuration(selection.duration);
        window.getMaster().getShowManager().play();
      }

      double startTime = System.currentTimeMillis() / 1000.0;

      double time;
      while (startTime + animation.getDuration() > (time = (System.currentTimeMillis() / 1000.0))) {
        animation.increment((time - startTime) / animation.getDuration());
        Thread.yield();
        PartyToolkit.sleep(10);
      }

      window.getMaster().getShowManager().pause();
    }
  }
示例#2
0
 public LightMaster getMaster() {
   return main.getMaster();
 }