how to pause & resume drawing a line ?
in
Programming Questions
•
2 years ago
hi there :)
I'm trying to draw a line separate when some keys pressed...
I'm not using line(mouseX, mouseY, pmouseX, pmouseY)
because I want to change the code that can be used with kinect, 3D.
There is a code.
I want to make
if DOWN arrow pressed, a line ends and mouse cursor moves without drawing a line,
if UP arrow pressed, a second line starts to be drawn (separate from the first line)
any idea? TAT
It is driving me crazy plz help !!!!!!!
- class Line {
- ArrayList<PVector> polyline = new ArrayList<PVector>();
- PVector origin;
- Line() {
- origin = new PVector(mouseX, mouseY);
- }
- void update() {
- polyline.add(new PVector(mouseX, mouseY));
- }
- void display() {
- noFill();
- strokeJoin(ROUND);
- stroke(0,0,255, 100);
- strokeWeight(10);
- beginShape();
- for(PVector p : polyline){
- vertex(p.x, p.y);
- }
- endShape();
- }
- }
- Line l;
- void setup() {
- size(400, 400);
- smooth();
- l = new Line ();
- }
- void draw() {
- background(0);
- l.update();
- l.display();
- }
1