Processing question
Processing question
- Started
- Last post
- 7 Responses
- Maaku
When I run the following program and start drawing, the line X and Y position begins from the upper left corner:
void setup() {
size(640, 200);
background(102);
}void draw() {
stroke(255);
if(mousePressed) {
line(mouseX, mouseY, pmouseX, pmouseY);
}
}Is this a bug? How can I make the line start from the mouse position?
- plash0
that's normal. 0,0 is at the upper left
- animatedgif0
Are you actually moving the mouse before clicking?
pmouse might not have been set yet if you're clicking too soon.
- uan0
- In regular Processing if you run it and don't move your mouse then it doesn't workanimatedgif
- Processing.js will be updating the pmousex before the mouse even hits the canvas I guessanimatedgif
- Maaku0
It does work for Processing.js and when running the program from a PC.....it might be a bug when it runs on mac, how weird.
Thanks!
- animatedgif0
- It'll only do that for me if I have my mouse over the area the windows spawns, and don't move before clicking.Jacque
- yeah that's what I meantanimatedgif