1-2.mouseClicked()
Name(名称):mouseClicked()//可以看做是鼠标按钮中断函数
Examples(例子):
// Click within the image to change单击图像中更改
// the value of the rectangle after矩形的颜色
// after the mouse has been clicked鼠标点击后
int value = 0;
void draw() {
fill(value);
rect(25, 25, 50, 50);
}
void mouseClicked() {
if (value == 0) {
value = 255;
} else {
value = 0;
}
}
Description(描述):The mouseClicked() function is called after a mouse button has been pressed and then released.
mouseClicked()函数在按下鼠标按钮之后调用,然后释放。
Mouse and keyboard events only work when a program has draw(). Without draw(), the code is only run once and then stops listening for events.
鼠标和键盘事件只在程序绘制()时才起作用。没有绘制(),代码只运行一次,然后停止监听事件。
Syntax(语法):mouseClicked()
mouseClicked(event)
Returns(返回值):Void(无)
Related(相关函数):mouseX
mouseY
pmouseX
pmouseY
mousePressed
mousePressed()
mouseReleased()
mouseClicked()
mouseMoved()
mouseDragged()
mouseButton
mouseWheel()
- 本文固定链接: http://iprocessing.cn/2017/07/14/mouseclicked鼠标单击/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表