/**
   * Instantiates a new blend transition.
   *
   * @param mtApplication the mt application
   * @param duration the duration
   */
  public BlendTransition(MTApplication mtApplication, long duration) {
    super(mtApplication, "Blend Transition");
    this.app = mtApplication;
    this.duration = duration;
    this.finished = true;

    anim =
        new Animation(
                "Blend animation ",
                new MultiPurposeInterpolator(255, 0, this.duration, 0, 0.7f, 1),
                this)
            .addAnimationListener(
                new IAnimationListener() {
                  public void processAnimationEvent(AnimationEvent ae) {
                    float val = ae.getAnimation().getInterpolator().getCurrentValue();
                    switch (ae.getId()) {
                      case AnimationEvent.ANIMATION_STARTED:
                        lastSceneRectangle.setVisible(true);
                      case AnimationEvent.ANIMATION_UPDATED:
                        lastSceneRectangle.setFillColor(new MTColor(255, 255, 255, val));
                        break;
                      case AnimationEvent.ANIMATION_ENDED:
                        lastSceneRectangle.setVisible(false);
                        lastSceneRectangle.setFillColor(new MTColor(255, 255, 255, val));
                        finished = true;
                        break;
                      default:
                        break;
                    }
                  }
                });
    anim.setResetOnFinish(true);
  }
  public void Make(MTAndroidApplication mtApplication, String name, Boolean out) {
    doSlideIn = out; // Check if the menu is to be called slided in, or
    // slided out.
    makeMapMenu(mtApplication, out);
    mapMenu.addChild(returnButton(mtApplication));
    StartTiamat.general.addChild(mapMenu);
    System.out.println("added menu");
    makeList(mtApplication);
    list.setPositionRelativeToParent(mapMenu.getCenterPointLocal());
    mapMenu.addChild(list);
    // Makes the buttons of the menu.
    for (int i = 0; i < StartTiamat.myFunctions.size(); i++) {
      vub.templates.Templates template =
          StartTiamat.myFunctions.get(
              i); // For each element in the myFunctions vector a button gets created.
      list.addListElement(
          this.createListCell(
              mtApplication,
              template.getName(),
              template.getFunction(),
              Tiamat.menuFont,
              cellWidth,
              cellHeight,
              cellFillColor,
              cellPressedFillColor));
    }
    ;

    MultiPurposeInterpolator in = new MultiPurposeInterpolator(0, 170, 700, 0.1f, 0.7f, 1);
    final Animation slideOut = new Animation("slide out animation", in, mapMenu);
    // The slide animations.
    slideOut.addAnimationListener(
        new IAnimationListener() {
          public void processAnimationEvent(AnimationEvent ae) {
            float delta = ae.getCurrentStepDelta();
            ((IMTComponent3D) ae.getTargetObject()).translateGlobal(new Vector3D(delta, 0, 0));
            switch (ae.getId()) {
              case AnimationEvent.ANIMATION_ENDED:
                doSlideIn = true;
                animationRunning = false;
                break;
            }
          }
        });

    final Animation slideIn = new Animation("slide out animation", in, mapMenu);
    slideIn.addAnimationListener(
        new IAnimationListener() {
          public void processAnimationEvent(AnimationEvent ae) {
            float delta = -ae.getCurrentStepDelta();
            ((IMTComponent3D) ae.getTargetObject()).translateGlobal(new Vector3D(delta, 0, 0));
            switch (ae.getId()) {
              case AnimationEvent.ANIMATION_ENDED:
                doSlideIn = false;
                animationRunning = false;
                break;
            }
          }
        });

    mapMenu.unregisterAllInputProcessors();
    mapMenu.registerInputProcessor(new TapProcessor(mtApplication, 50));
    mapMenu.addGestureListener(
        TapProcessor.class,
        new IGestureEventListener() {
          public boolean processGestureEvent(MTGestureEvent ge) {
            TapEvent te = (TapEvent) ge;
            if (te.isTapped()) {
              if (!animationRunning) {
                animationRunning = true;
                if (doSlideIn) {
                  slideIn.start();
                } else {
                  slideOut.start();
                }
              }
            }
            return false;
          }
        });
  };
  public void Make(AbstractMTApplication mtApplication, String name) {
    /// Create map provider menu \\\
    IFont font =
        FontManager.getInstance()
            .createFont(mtApplication, "SansSerif.Bold", 15, MTColor.WHITE, MTColor.WHITE);
    MTRoundRectangle mapMenu = new MTRoundRectangle(0, 0, 0, 220, 335, 20, 20, mtApplication);
    mapMenu.setFillColor(new MTColor(35, 35, 35, 180));
    mapMenu.setStrokeColor(new MTColor(35, 35, 35, 180));
    mapMenu.setPositionGlobal(new Vector3D(mtApplication.width / 2f, mtApplication.height / 2f));
    mapMenu.translateGlobal(new Vector3D(-mtApplication.width / 2f - 80, 0));
    MTRectangle drawing = new MTRectangle(0, 0, 200, 200, mtApplication);
    StartTiamat.general.addChild(mapMenu);
    System.out.println("added menu");
    float cellWidth = 155;
    float cellHeight = 40;
    MTColor cellFillColor = new MTColor(new MTColor(0, 0, 0, 210));
    MTColor cellPressedFillColor = new MTColor(new MTColor(20, 20, 20, 220));
    MTList list = new MTList(0, 0, 152, 4 * cellHeight + 4 * 3, mtApplication);
    list.setChildClip(null);
    list.setNoFill(true);
    list.setNoStroke(true);
    list.unregisterAllInputProcessors();
    list.setAnchor(PositionAnchor.CENTER);
    list.setPositionRelativeToParent(mapMenu.getCenterPointLocal());
    mapMenu.addChild(list);

    for (int i = 0; i < StartTiamat.functions.size(); i++) {
      Tiamat.Templates template = StartTiamat.functions.get(i);
      list.addListElement(
          this.createListCell(
              mtApplication,
              template.getName(),
              template.getFunction(),
              font,
              cellWidth,
              cellHeight,
              cellFillColor,
              cellPressedFillColor));
    }
    ;
    MultiPurposeInterpolator in = new MultiPurposeInterpolator(0, 170, 700, 0.1f, 0.7f, 1);
    final Animation slideOut = new Animation("slide out animation", in, mapMenu);
    slideOut.addAnimationListener(
        new IAnimationListener() {
          public void processAnimationEvent(AnimationEvent ae) {
            float delta = ae.getCurrentStepDelta();
            ((IMTComponent3D) ae.getTargetObject()).translateGlobal(new Vector3D(delta, 0, 0));
            switch (ae.getId()) {
              case AnimationEvent.ANIMATION_ENDED:
                doSlideIn = true;
                animationRunning = false;
                break;
            }
          }
        });

    final Animation slideIn = new Animation("slide out animation", in, mapMenu);
    slideIn.addAnimationListener(
        new IAnimationListener() {
          public void processAnimationEvent(AnimationEvent ae) {
            float delta = -ae.getCurrentStepDelta();
            ((IMTComponent3D) ae.getTargetObject()).translateGlobal(new Vector3D(delta, 0, 0));
            switch (ae.getId()) {
              case AnimationEvent.ANIMATION_ENDED:
                doSlideIn = false;
                animationRunning = false;
                break;
            }
          }
        });

    mapMenu.unregisterAllInputProcessors();
    mapMenu.registerInputProcessor(new TapProcessor(mtApplication, 50));
    mapMenu.addGestureListener(
        TapProcessor.class,
        new IGestureEventListener() {
          public boolean processGestureEvent(MTGestureEvent ge) {
            if (((TapEvent) ge).getTapID() == TapEvent.BUTTON_CLICKED) {
              if (!animationRunning) {
                animationRunning = true;
                if (doSlideIn) {
                  slideIn.start();
                } else {
                  slideOut.start();
                }
              }
            }
            return false;
          }
        });
  }