Loading...
Logo
Processing Forum
thatgirld's Profile
1 Posts
2 Responses
0 Followers

Activity Trend

Last 30 days

Loading Chart...

Show:
Private Message
    hi

    i'm new to procesing and i was wondering if you could help me with my code
    i want my shape to be stored after i close the shape or right-click, so i can start making a new shape

    something like this:  http://www.openprocessing.org/sketch/60524

    could you please help me

    kind regards,
    diane



    ArrayList point1 = new ArrayList();

    void setup(){
    size(1076,672);
    smooth();
    strokeWeight(2);
    }

    void draw(){
    background(255);
    beginShape();
    fill(0,95);
    for(int i = 0; i < point1.size(); i++){
    vertex(((Point)point1.get(i)).x, ((Point)point1.get(i)).y);
    }
    endShape(CLOSE); 
    }

    class Point {
    int x, y;
    Point(int a, int b) {
    x = a;
    y = b;
    }
    }

    void mousePressed(){
    if(mouseButton == LEFT){
    point1.add(new Point(mouseX, mouseY));
    }
    }