当前位置: 首页>>代码示例>>Java>>正文


Java AnimationAction类代码示例

本文整理汇总了Java中jkanvas.animation.AnimationAction的典型用法代码示例。如果您正苦于以下问题:Java AnimationAction类的具体用法?Java AnimationAction怎么用?Java AnimationAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AnimationAction类属于jkanvas.animation包,在下文中一共展示了AnimationAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ParticleProvider

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Creates a particle provider.
 * 
 * @param animator The animator.
 * @param trails The render pass.
 * @param slicer The slicer.
 * @param sliceTime The time to display one slice.
 */
public ParticleProvider(final Animator animator, final TrailRenderpass trails,
    final TimeSlicer slicer, final long sliceTime) {
  Objects.requireNonNull(animator);
  Objects.requireNonNull(slicer);
  this.trails = Objects.requireNonNull(trails);
  this.sliceTime = sliceTime;
  unused = new ConcurrentLinkedQueue<>();
  final ParticleProvider thiz = this;
  tick = new AnimationAction() {

    @Override
    public void animationFinished() {
      final TrailRenderpass t = thiz.getTrailRenderpass();
      slicer.timeSlice(thiz, t.getWidth(), t.getHeight());
      thiz.cleanUpUnused();
      animator.getAnimationList().scheduleAction(thiz.getTick(), thiz.getFor(1));
    }

  };
  animator.getAnimationList().scheduleAction(tick, AnimationTiming.NO_ANIMATION);
}
 
开发者ID:JosuaKrause,项目名称:Trails,代码行数:30,代码来源:ParticleProvider.java

示例2: startPath

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Activates this particle and starts a path.
 * 
 * @param startX The start x coordinate.
 * @param startY The start y coordinate.
 * @param end The end position.
 * @param slices How many slices the particle needs for its trip.
 * @param size The size of the particle.
 * @param color The color. {@link Particle#RED}, {@link Particle#GREEN}, or
 *          {@link Particle#BLUE}.
 */
public void startPath(final double startX, final double startY,
    final Point2D end, final int slices, final double size, final int color) {
  final PathParticle thiz = this;
  inUse = true;
  setSize(size);
  setPosition(startX, startY);
  setColor(color);
  startAnimationTo(end, getFor(slices), new AnimationAction() {

    @Override
    public void animationFinished() {
      inUse = false;
      setPosition(Double.NaN, Double.NaN);
      setSize(Double.NaN);
      unused.add(thiz);
    }

  });
}
 
开发者ID:JosuaKrause,项目名称:Trails,代码行数:31,代码来源:ParticleProvider.java

示例3: startLayout

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Computes the layout.
 * 
 * @param deregisterOnEnd Whether to unregister the layouter after completion.
 */
protected void startLayout(final boolean deregisterOnEnd) {
  // check whether we are still registered
  if(view == null) return;
  final boolean chg = doLayout(view);
  if(!chg || !iterate()) {
    if(deregisterOnEnd) {
      deregister();
    }
    return;
  }
  // TODO #43 -- Java 8 simplification
  canvas.scheduleAction(new AnimationAction() {

    @Override
    public void animationFinished() {
      startLayout(deregisterOnEnd);
    }

  }, timing);
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:26,代码来源:AbstractLayouter.java

示例4: removeRows

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Removes rows. Note that it is not allowed to remove all rows.
 * 
 * @param from The starting index inclusive.
 * @param to The end index exclusive.
 * @param timing The animation timing.
 */
public synchronized void removeRows(
    final int from, final int to, final AnimationTiming timing) {
  if(to - from >= rows()) throw new IllegalArgumentException("cannot remove all rows");
  ensureChangeAllowed();
  Objects.requireNonNull(timing);
  noChange = true;
  for(final AnimatedDouble d : heights.subList(from, to)) {
    d.startAnimationTo(0.0, timing);
  }
  // TODO #43 -- Java 8 simplification
  animator.getAnimationList().scheduleAction(new AnimationAction() {

    @Override
    public void animationFinished() {
      noChange = false;
      removeRows(from, to);
    }

  }, timing);
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:28,代码来源:AnimatedMatrix.java

示例5: removeColumns

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Removes columns. Note that it is not allowed to remove all columns.
 * 
 * @param from The starting index inclusive.
 * @param to The end index exclusive.
 * @param timing The animation timing.
 */
public synchronized void removeColumns(
    final int from, final int to, final AnimationTiming timing) {
  if(to - from >= cols()) throw new IllegalArgumentException(
      "cannot remove all columns");
  ensureChangeAllowed();
  Objects.requireNonNull(timing);
  noChange = true;
  for(final AnimatedDouble d : widths.subList(from, to)) {
    d.startAnimationTo(0.0, timing);
  }
  // TODO #43 -- Java 8 simplification
  animator.getAnimationList().scheduleAction(new AnimationAction() {

    @Override
    public void animationFinished() {
      noChange = false;
      removeColumns(from, to);
    }

  }, timing);
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:29,代码来源:AnimatedMatrix.java

示例6: setRestriction

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Setter.
 * 
 * @param restriction Sets the restriction rectangle.
 * @param timing How the transition to the restriction rectangle should be
 *          performed.
 * @param margin The margin added to the rectangle.
 * @param onFinish The action that is performed after the restriction has been
 *          set or <code>null</code>.
 * @throws IllegalStateException When the canvas is not restricted. The canvas
 *           can be restricted only with the constructor.
 * @see #isRestricted()
 */
public void setRestriction(final Rectangle2D restriction,
    final AnimationTiming timing, final double margin, final AnimationAction onFinish) {
  if(!isRestricted()) throw new IllegalStateException("not restricted");
  this.restriction = null;
  if(restriction != null) {
    final Rectangle2D rest = jkanvas.util.PaintUtil.addPadding(restriction, margin);
    if(rest.isEmpty()) throw new IllegalArgumentException(
        "no empty restriction allowed");
    // TODO #43 -- Java 8 simplification
    zui.toView(rest, timing, new AnimationAction() {

      @Override
      public void animationFinished() {
        if(!zui.inAnimation()) {
          setRestrictionDirectly(rest);
        }
        if(onFinish != null) {
          onFinish.animationFinished();
        }
      }

    }, false);
  }
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:38,代码来源:ViewConfiguration.java

示例7: beforeAnimation

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
@Override
protected AnimationAction beforeAnimation(
    final AnimationTiming timing, final AnimationAction onFinish) {
  if(timing.duration <= 0) return onFinish;
  pass.setForceCache(true);
  // TODO #43 -- Java 8 simplification
  return new AnimationAction() {

    @Override
    public void animationFinished() {
      pass.setForceCache(false);
      if(onFinish != null) {
        onFinish.animationFinished();
      }
    }

  };
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:19,代码来源:RenderGroup.java

示例8: postMessage

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Posts a message to be processed by {@link KanvasInteraction} in the future.
 * A message consists of two parts: The optional id part and the actual
 * message. The id is separated from the message via the character '
 * <code>#</code>'. Multiple ids may be passed by separating them with space '
 * <code> </code>'
 *
 * @param msg The message to post.
 * @param delay The time in milliseconds until the message is processed.
 * @throws IllegalArgumentException If the message part is empty.
 */
public void postMessage(final String msg, final long delay) {
  validateMessage(msg);
  scheduleAction(new AnimationAction() {

    @Override
    public void animationFinished() {
      postMessage(msg);
    }

  }, delay);
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:23,代码来源:Canvas.java

示例9: doLayout

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
@Override
protected final void doLayout(final List<RenderpassPosition<T>> members) {
  final AnimationTiming timing = getTiming();
  final boolean horizontal = isHorizontal();
  final double alignmentFactor = getAlignment();
  final double space = getSpace();
  final List<Rectangle2D> bboxes = new ArrayList<>(members.size());
  double maxH = 0;
  double maxV = 0;
  for(final RenderpassPosition<T> p : members) {
    final Renderpass pass = p.pass;
    final Rectangle2D bbox = new Rectangle2D.Double();
    pass.getBoundingBox(bbox);
    bboxes.add(bbox);
    if(!pass.isVisible()) {
      continue;
    }
    final double w = bbox.getWidth();
    final double h = bbox.getHeight();
    if(w > maxH) {
      maxH = w;
    }
    if(h > maxV) {
      maxV = h;
    }
  }
  final AnimationAction cof = clearCurrentOnFinish();
  getAnimator().getAnimationList().scheduleAction(cof, timing);
  chooseLayout(members, timing, horizontal, alignmentFactor, space, bboxes, maxH, maxV);
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:31,代码来源:LinearGroup.java

示例10: setExpanded

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Setter.
 * 
 * @param expanded Whether the group is expanded.
 * @param onFinish The action that will be performed after the laying out is
 *          complete.
 */
public void setExpanded(final boolean expanded, final AnimationAction onFinish) {
  this.expanded = expanded;
  final AnimationAction of = getOnFinish();
  setOnFinish(onFinish);
  invalidate();
  setOnFinish(of);
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:15,代码来源:ExpandableGroup.java

示例11: setupOverviewAndContext

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Adds an overview to the given painter.
 * 
 * @param c The canvas.
 * @param ap The painter.
 * @param rp The render item to use as overview.
 * @param preventUserZoom Whether to prevent the user from using zoom.
 */
public static final void setupOverviewAndContext(final Canvas c,
    final AnimatedPainter ap, final Renderpass rp, final boolean preventUserZoom) {
  c.scheduleAction(new AnimationAction() {

    @Override
    // TODO #43 -- Java 8 simplification
    public void animationFinished() {
      setup(c, ap, rp, preventUserZoom);
    }

  }, 0);
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:21,代码来源:OverviewHUD.java

示例12: setup

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Sets up the overview.
 * 
 * @param c The canvas.
 * @param ap The painter.
 * @param rp The render item.
 * @param preventUserZoom Whether to prevent user initiated zoom.
 */
static final void setup(final Canvas c, final RenderpassPainter ap,
    final Renderpass rp, final boolean preventUserZoom) {
  final Rectangle2D bbox = new Rectangle2D.Double();
  RenderpassPainter.getTopLevelBounds(bbox, rp);
  final OverviewHUD overview = new OverviewHUD(c, rp, 100.0);
  c.setRestriction(bbox, AnimationTiming.NO_ANIMATION, new AnimationAction() {

    @Override
    // TODO #43 -- Java 8 simplification
    public void animationFinished() {
      if(preventUserZoom) {
        c.setUserZoomable(false);
      }
      overview.setView(0);
    }

  });
  ap.addHUDPass(overview);
  c.addComponentListener(new ComponentAdapter() {

    @Override
    // TODO #43 -- Java 8 simplification
    public void componentResized(final ComponentEvent e) {
      overview.setView(overview.getView());
    }

  });
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:37,代码来源:OverviewHUD.java

示例13: toView

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
@Override
public void toView(final Rectangle2D rect, final AnimationTiming timing,
    final AnimationAction onFinish, final boolean useMargin) {
  Objects.requireNonNull(rect);
  Objects.requireNonNull(timing);
  final Rectangle2D r =
      useMargin ? jkanvas.util.PaintUtil.addPadding(rect, canvas.getMargin()) : rect;
  if(r.isEmpty()) {
    canvas.scheduleAction(onFinish, timing);
    return;
  }
  ensureView();
  view.set(getView());
  view.startAnimationTo(r, timing, onFinish);
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:16,代码来源:CameraZUI.java

示例14: setupCanvas

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
/**
 * Sets up the canvas.
 * 
 * @param frame The frame.
 * @param mng The JSON manager.
 * @param json The JSON resource.
 * @param show Whether to make the frame visible.
 * @param reset Whether to reset the view.
 * @throws IOException I/O Exception.
 */
public static void setupCanvas(final JFrame frame, final JSONManager mng,
    final Resource json, final boolean show, final boolean reset) throws IOException {
  mng.addRawId("frame", frame);
  final Canvas canvas = loadCanvas(new JSONReader(json.reader()).get(), mng);
  // pack and show window
  frame.add(canvas);
  frame.pack();
  frame.setLocationRelativeTo(null);
  frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  final WindowAdapter wnd = Canvas.getWindowAdapter(frame, canvas);
  frame.addWindowListener(wnd);
  frame.addWindowStateListener(wnd);
  if(show) {
    frame.setVisible(true);
  }
  if(reset) {
    // TODO #43 -- Java 8 simplification
    canvas.scheduleAction(new AnimationAction() {

      @Override
      public void animationFinished() {
        canvas.reset();
      }

    }, 0);
  }
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:38,代码来源:JSONSetup.java

示例15: invalidate

import jkanvas.animation.AnimationAction; //导入依赖的package包/类
@Override
public void invalidate() {
  super.invalidate();
  final AnimationAction cof = curOnFinish.getAndSet(onFinish);
  getAnimator().getAnimationList().scheduleAction(cof, timing);
}
 
开发者ID:JosuaKrause,项目名称:JKanvas,代码行数:7,代码来源:LinearGroup.java


注:本文中的jkanvas.animation.AnimationAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。