首页 > 文档 > mouseDragged()鼠标拖动
2017
07-14

mouseDragged()鼠标拖动

 

1-3.mouseDragged()

Name(名称):mouseDragged()//可以看做是按下鼠标按钮并移动中断函数

Examples(例子):

// Drag (click and hold) your mouse across the拖动(点击并按住)鼠标越过

// image to change the value of the rectangle图像改变矩形的颜色

int value = 0;

void draw() {

fill(value);

rect(25, 25, 50, 50);

}

void mouseDragged()

{

value = value + 5;

if (value > 255) {

value = 0;

}

}

Description(描述):The mouseDragged() function is called once every time the mouse moves while a mouse button is pressed. (If a button is not being pressed, mouseMoved() is called instead.)

mouseDragged ()函数在每次鼠标移动的同时调用鼠标。(如果没有按下按钮,则使用mouseMoved()来代替。)

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.

鼠标和键盘事件只在draw()时才起作用。没有draw(),代码只运行一次,然后停止监听事件。

Syntax(语法):mouseDragged()

mouseDragged(event)

Returns(返回值):Void(

Related(相关函数):mouseX
mouseY
pmouseX
pmouseY
mousePressed
mousePressed()
mouseReleased()
mouseClicked()
mouseMoved()
mouseButton
mouseWheel()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。