矩形正在移动,当我点击它时,需要以0.1而不是3移动。我不知道如何对mousePressed部分进行编码,以便它始终保持0.1。如何让这个矩形变慢?
float stripeX = 0;
void setup() {
size(500, 300);
}
void draw() {
background(255);
fill(10, 10, 100);
rect(stripeX, 90, 150, 250);
stripeX = stripeX + 3;
stripeX = stripeX % width;
}
void mousePressed() {
stripeX = stripeX - 2.9;
}