Changes

Jump to: navigation, search

FSOSS 2010/processing.js/example6

105 bytes added, 12:20, 26 October 2010
no edit summary
/*
FSOSS 2010
Andor Salga
Example of line, ArrayList, mousePressed, mouseReleased
*/
boolean drawingLine = false;
float lineX1lineX;float lineY1; float lineX2;float lineY2lineY;
ArrayList lineCoords;
void setup(){
size(300, 300);
lineCoords = new ArrayList();
}
void draw(){
background(33, 66, 99);
}
//
if(drawingLine){
line(lineX1lineX, lineY1lineY, mouseX, mouseY);
}
}
/*
Function gets called once, as soon as the
void mousePressed(){
drawingLine = true;
lineX1 lineX = (float) mouseX; lineY1 lineY = (float) mouseY;
}
/*
Function gets called once, as soon as the
drawingLine = false;
lineCoords.add(lineX1lineX); lineCoords.add(lineY1lineY);
lineCoords.add((float) mouseX);
lineCoords.add((float) mouseY);
println(lineX + " " + lineY + " " + mouseX + " " + mouseY);
}
</source>
[http://studio.sketchpad.cc/???? JzipgTGyKN Run me]
1
edit

Navigation menu