loop()

本参考资料用于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.

名称

loop()

示例


void setup()
{  
size(200, 200);


noLoop();

// draw() will not loop
  } float x = 0;


void draw()
{  
background(204);


x = x + .1;

 
if (x > width)
{
x = 0;


  }   line(x, 0, x, height);

  } 
void mousePressed()
{  
loop();

// Holding down the mouse activates looping
  } 
void mouseReleased()
{  
noLoop();

// Releasing the mouse stops looping draw()
  } 
描述 By default, Processing loops through draw() continuously, executing the code within it. However, the draw() loop may be stopped by calling noLoop(). In that case, the draw() loop can be resumed with loop().
语法
loop()
返回值 void
相关 noLoop()
redraw()
draw()

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

loop()