Examples of Animator


Examples of org.jdesktop.core.animation.timing.Animator

    if (controller == null) {
      throw new NullPointerException();
    }
   
    if (controller.hasOffsetAnimator()) {
      Animator animator = controller.getOffsetAnimator();
      animator.cancel();
      controller.setOffsetAnimator(null);
    }

    Rectangle bounds = controller.getItemBounds();
    bounds.x += controller.getOffset();
    final int from = bounds.x;
   
    TimingTarget tt = new TimingTargetAdapter() {
      @Override
      public void timingEvent(Animator source, double fraction) {
        int distance = (int )Math.round(((double )to - (double )from) * fraction);
       
        Rectangle bounds = controller.getItemBounds();
        int oldOffset = controller.getOffset();
        int newOffset = from + distance - bounds.x;
        controller.setOffset(newOffset);
       
        if (!hasDraggedItem()) {
          Point mouseLocation = getDisplay().getCursorLocation();
          mouseLocation = toControl(mouseLocation);
          Rectangle testBounds = controller.getItemBounds();
          testBounds.x += controller.getOffset();
         
          if (testBounds.contains(mouseLocation)) {
            processFocus(controller);
          } else {
            processFocus(null);
          }
        }
       
        redraw(bounds.x + oldOffset, bounds.y, bounds.width, bounds.height, true);
        redraw(bounds.x + newOffset, bounds.y, bounds.width, bounds.height, true);
      }
      @Override
      public void end(Animator source) {
        Rectangle oldBounds = controller.getItemBounds();
        oldBounds.x += controller.getOffset();
       
        Rectangle newBounds = controller.getItemBounds();
        int newOffset = to - newBounds.x;
        controller.setOffset(newOffset);
        newBounds.x += newOffset;
       
        redraw(oldBounds.x, oldBounds.y, oldBounds.width, oldBounds.height, true);
        redraw(newBounds.x, newBounds.y, newBounds.width, newBounds.height, true);
      }
    };
   
    Interpolator interpol = new AccelerationInterpolator(0, 0.9);
    Animator animator = new Animator.Builder().addTarget(tt).setDuration(160, TimeUnit.MILLISECONDS).setInterpolator(interpol).build();
    controller.setOffsetAnimator(animator);
    animator.start();
  }
View Full Code Here

Examples of org.jdesktop.core.animation.timing.Animator

    if (controller == null) {
      throw new NullPointerException();
    }
   
    if (controller.hasBackgroundAnimator()) {
      Animator animator = controller.getBackgroundAnimator();
      animator.cancel();
      controller.setBackgroundAnimator(null);
    }
   
    final RGB from = controller.getBackground();
   
    TimingTarget tt = new TimingTargetAdapter() {
      @Override
      public void timingEvent(Animator source, double fraction) {
        double r = to.red - from.red;
        double g = to.green - from.green;
        double b = to.blue - from.blue;
       
        r *= fraction;
        g *= fraction;
        b *= fraction;
       
        r += from.red;
        g += from.green;
        b += from.blue;
       
        int red = (int )Math.round(r);
        int green = (int )Math.round(g);
        int blue = (int )Math.round(b);

        RGB rgb = new RGB(red, green, blue);
        controller.setBackground(rgb);
       
        Rectangle bounds = controller.getItemBounds();
        redraw(bounds.x, bounds.y, bounds.width, bounds.height, true);
      }
      @Override
      public void end(Animator source) {
        controller.setBackground(to);
       
        Rectangle bounds = controller.getItemBounds();
        redraw(bounds.x, bounds.y, bounds.width, bounds.height, true);
      }
    };
   
    Interpolator interpol = new AccelerationInterpolator(0, 0.9);
    Animator animator = new Animator.Builder().addTarget(tt).setDuration(160, TimeUnit.MILLISECONDS).setInterpolator(interpol).build();
    controller.setBackgroundAnimator(animator);
    animator.start();
  }
View Full Code Here

Examples of org.jpacman.framework.view.Animator

  public MainUI createUI() throws FactoryException {
      assert getGame() != null;
      assert ghostController != null;
     
        boardView = createBoardView();
        animator = new Animator(boardView);
     
        if (pi == null) { pi = new PacmanInteraction(); }
       
        pi.withDisposable(this)
        .withGameInteractor(getGame())
View Full Code Here

Examples of org.pokenet.client.backend.Animator

    /*
     * The animator and map matrix
     */
    m_mapMatrix = new ClientMapMatrix();
    m_animator = new Animator(m_mapMatrix);

    gc.getInput().enableKeyRepeat(50, 300);
//    LoadingList.setDeferredLoading(false);

  }
View Full Code Here

Examples of vee.animation.Animator

   * and lay them out on this panel.
   *
   */
  private void setup() {
    // build an animator for our automaton.
    mAnimator = new Animator(mHenchwoman);
//    mAnimator.addToAnimationList(mPlayer);

    setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));

    add(mAnimator);
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.