Line Drawing (mouse speed)


/ Published in: Processing
Save to your folder(s)

Draw line on mousedown.\r\nLine width based on mouse movement.


Copy this code and paste it in your HTML
  1. void draw() {
  2. stroke(255);
  3. strokeWeight(abs(mouseX-pmouseX));
  4. if (mousePressed && mouseButton == RIGHT) {
  5. background(0);
  6. println (mouseButton);
  7. } else if (mousePressed && mouseButton == LEFT) {
  8. line(pmouseX,pmouseY,mouseX,mouseY);
  9. }
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.