Examples of DancingFlameStack


Examples of org.jwildfire.create.tina.dance.DancingFlameStack

    if (recorder.getRecordedActions().size() >= 2) {
      List<Flame> flames = new ArrayList<Flame>();
      int actionIdx = 0;

      StartAction startAction = (StartAction) recorder.getRecordedActions().get(actionIdx++);
      DancingFlameStack flameStack = new DancingFlameStack(prefs);
      flameStack.addFlame(startAction.getFlame(), 0, project.getMotions(startAction.getFlame()));
      RecordedAction nextAction = recorder.getRecordedActions().get(actionIdx++);
      long timeRenderStarted = System.currentTimeMillis();
      long nextFrame = (long) (timeRenderStarted + 1000.0 / (double) thread.getFramesPerSecond() + 0.5);
      while (true) {
        long time = System.currentTimeMillis();
        while (time < nextFrame) {
          try {
            Thread.sleep(1);
          }
          catch (Exception ex) {
            ex.printStackTrace();
          }
          time = System.currentTimeMillis();
        }
        nextFrame = (long) (time + 1000.0 / (double) thread.getFramesPerSecond() + 0.5);

        DancingFlame dancingFlame = flameStack.getFlame();

        Flame renderFlame;
        if (fftData != null) {
          long currTime = time - timeRenderStarted;
          short currFFT[] = fftData.getDataByTimeOffset(currTime);
          Flame transforedFlame = transformer.createTransformedFlame(dancingFlame, currFFT, currTime, thread.getFramesPerSecond());
          renderFlame = new FlamePreparer(prefs).createRenderFlame(transforedFlame);
        }
        else {
          renderFlame = new FlamePreparer(prefs).createRenderFlame(dancingFlame.getFlame());
        }

        flames.add(renderFlame);
        if (time >= timeRenderStarted + nextAction.getTime()) {
          if (nextAction instanceof StopAction) {
            break;
          }
          else if (nextAction instanceof FlameChangeAction) {
            Flame nextFlame = ((FlameChangeAction) nextAction).getFlame();
            flameStack.addFlame(nextFlame, ((FlameChangeAction) nextAction).getMorphFrameCount(), project.getMotions(nextFlame));
            nextAction = recorder.getRecordedActions().get(actionIdx++);
          }
          else {
            throw new Exception("Unknown action type <" + nextAction.getClass() + ">");
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.