title: How can I draw a circle that compounds your cursor movement?
body: <p>I am trying to draw a circle with my cursor while I am moving it. I know the circle wont be perfect but that does not really matter I just need the circle to compound on top of my organic cursor movements. I originally tried to do this with java's awt robot class but that ended up being futile because anytime I moved my mouse massive lines would extend infinitely far from where I made that movement. Here are two sets of code I tried (keep in mind I am calling these from a  nativeMousePress event so I am holding down the left click the whole time).</p>
  <pre><code>        int radius = 100;
          for (double i = 0; i &lt; (2 * Math.PI) + Math.PI / 6; i = i + Math.PI / 6) {
              PointerInfo pointerA = MouseInfo.getPointerInfo();
              Point a = pointerA.getLocation();
              int yStart = (int) a.getY();
              int xStart = (int) a.getX();
              robot.mouseMove((int) ((xStart) + (radius * Math.cos(i))), (int) ((yStart) + (radius * Math.sin(i))));
              robot.delay(68);
          }
  </code></pre>
  <p>Here is my another attempt I had. I also want to mention that I need the delay in between each stroke.</p>
  <pre><code>    robot.mouseMove(getX() + 40, getY() + 20);
      robot.delay(1000);
      robot.mouseMove(getX() + 20, getY() + 40);
      robot.delay(1000);
      robot.mouseMove(getX() - 20, getY() + 40);
      robot.delay(1000);
      robot.mouseMove(getX() - 40, getY() + 20);
      robot.delay(1000);
      robot.mouseMove(getX() - 40, getY() - 20);
      robot.delay(1000);
      robot.mouseMove(getX() - 20, getY() - 40);
      robot.delay(1000);
      robot.mouseMove(getX() + 20, getY() - 40);
      robot.delay(1000);
      robot.mouseMove(getX() + 40, getY() - 20);
  
  
  public int getX() {
      PointerInfo pointerA = MouseInfo.getPointerInfo();
      Point a = pointerA.getLocation();
      return (int) a.getX();
  }
  
  public int getY() {
      PointerInfo pointerA = MouseInfo.getPointerInfo();
      Point a = pointerA.getLocation();
      return (int) a.getY();
  }
  </code></pre>
  <p>Ok now here is the image that shows what happens when I barely move my mouse. This happens with both sets of code even though each set of code makes the circle slightly different.
  <a href="https://i.stack.imgur.com/mbp98.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mbp98.png" alt="enter image description here" /></a></p>
  <p>Now to reiterate what I am trying to do I want to be able to move my mouse freely around the canvas while the code tries to make circles which should likely lead to a compounding effect. The issue is when I tried to use the robot class it completely bugs out and makes massive lines every which way if you attempt to move the mouse. I already asked other people about this and no one could figure out a solution to this so I am wondering if there is another class I can access that can do what I am looking for. Anyways here is a picture of what I assume it would look like if I moved my cursor to the right and if my circle code worked. (I already figured out how to do the loop effect)
  <a href="https://i.stack.imgur.com/9ahKr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9ahKr.png" alt="enter image description here" /></a></p>
  <p>Lastly I wanted to mention that I dont want a solution that provides code that can make the shape I showed above because thats not the point since I plan to do more complex things with this later. I just really need to know how to automate moving my cursor while having its movements compound with my active mouse movements.</p>