Exemplo n.º 1
0
  @Override
  public void run() {
    final Canvas canvas = buildSimpleCanvas();

    final Layer layer = canvas.getCamera().getLayer(0);
    final Root root = canvas.getCamera().getRoot();

    addNodesToLayer(layer, NODE_COUNT);

    layer.setLayout(new RandomLayout());

    root.getScheduler().schedule(new RandomCameraScheduler(canvas));

    JFrame frame = wrapCanvasWithFrame(canvas, NODE_COUNT + " nodes with random camera transform");

    frame.setVisible(true);
  }
Exemplo n.º 2
0
    private void scheduleRandomCameraAnimation(final Canvas canvas, final long currentTime) {
      double randomScale = random.nextDouble() * 2d + 1d;
      double randomX = random.nextDouble() * 500;
      double randomY = random.nextDouble() * 500;

      AffineTransform newTransform = createRandomCameraTransform(randomScale, randomX, randomY);

      canvas.getCamera().animateViewToTransform(newTransform, 1000);
    }