How do I make a line that is in the left corner and that I can move with the mouse but leave notrail

edited May 2017 in How To...

So basically a friend told me to do that and I'm not that good at processing so, I Think he ment that by movign the mouse the line would follow me but not draw any layers on the background, so how do I do this? Anyone? Codes from the sick coders?

Answers

  • Answer ✓

    Demo code below. Check the reference for documentation of each function. I recommend you review setup() and draw() specifically.

    Kf

    final int lineLen=25;
    void setup(){
      size(400,400);
      stroke(255);
      strokeWeight(3);
    }
    
    void draw(){
      background(0);
      line(mouseX-lineLen,mouseY-lineLen,mouseX+lineLen,mouseY+lineLen);
    }
    
  • not draw any layers on the background

    You should also review the background() command in the reference.

Sign In or Register to comment.