keyPressed

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

名称

keyPressed

示例
 // Click on the image to give it focus, // and then press any key.  // Note: The rectangle in this example may  // flicker as the operating system may  // register a long key press as a repetition // of key presses. 
void draw()
{  
if (keyPressed == true)
{
fill(0);


  } else{
fill(255);


  }   rect(25, 25, 50, 50);


  } 
描述 The boolean system variable keyPressed is true if any key is pressed and false if no keys are pressed.

Note that there is a similarly named function called keyPressed(). See its reference page for more information.

相关 key
keyCode
keyPressed()
keyReleased()

Updated on October 2, 2018 05:02:10pm EDT

keyPressed