Processing学习笔记 之 Processing简要执行过程
来源:互联网 发布:宋承宪刘亦菲分手知乎 编辑:程序博客网 时间:2024/05/20 06:41
参考文献:http://processing.org/reference/
Processing执行过程:
第一步执行setup()
Called once when theprogram is started. Used to define initial enviromentproperties such as screen size, background color, loading images, etc. beforethe draw() begins executing. Variables declared within setup() arenot accessible within other functions, includingdraw(). There can onlybe one setup() function for each program and it should not becalled again after it's initial execution.
第二步执行draw()
Called directlyafter setup() and continuously executes the lines of code containedinside its block until the program is stopped or noLoop() iscalled. The draw()functionis called automatically and should never be called explicitly. It should always be controlled with noLoop(), redraw() and loop().After noLoop() stops the code indraw() fromexecuting, redraw() causes the code inside draw() toexecute once and loop() will causes the code inside draw() toexecute continuously again. The number of times draw() executesin each second may be controlled with the delay()and frameRate() functions. There canonly be one draw() function for each sketch and draw() mustexist if you want the code to run continuously or to process events suchas mousePressed(). Sometimes, you might have an empty call to draw() inyour program as shown in the above example.
loop()
Causes Processing to continuously executethe code within draw(). If noLoop() is called, thecode in draw() stops executing.
noLoop()
Stops Processing from continuouslyexecuting the code within draw(). If loop() iscalled, the code in draw() begin to run continuously again. Ifusing noLoop() insetup(), it should be the last lineinside the block.
When noLoop() is used, it's not possible to manipulate oraccess the screen inside event handling functions such as mousePressed() or keyPressed().Instead, use those functions to call redraw() or loop(),which will run draw(), which can update the screen properly. Thismeans that when noLoop() has been called, no drawing can happen, and functionslike saveFrame() or loadPixels() may not be used.
Note that if the sketch is resized, redraw() willbe called to update the sketch, even after noLoop() has beenspecified. Otherwise, the sketch would enter an odd state until loop() wascalled.
- Processing学习笔记 之 Processing简要执行过程
- processing 学习第一天笔记
- processing 学习第二天笔记
- processing第三天学习笔记
- processing 第四天学习笔记
- Processing学习笔记---基本结构
- 学习Processing~
- Processing学习笔记--Difference of Processing from traditional programming languages
- NLP学习笔记1 text processing
- 三、openCV学习笔记(Image Processing)
- processing学习笔记2--弹球游戏1.0
- 【Natural Language Processing】seq2seq学习笔记
- Python processing学习
- Processing学习(一)
- Processing学习(二)
- Processing 学习资料
- 【Processing学习】Project1
- Python processing学习
- 使用之前需要自己下载jspSmartUpload.jar包
- 总该说点什么... ...
- shell
- apache安装&配置
- 学习记录
- Processing学习笔记 之 Processing简要执行过程
- Part1. poi 新手教程
- Xen PV Guest interrupt
- 设计模式学习-Builder(生成器
- 反射_综合应用_用a代替b
- Part2. poi读取excel教程
- 窗口顶层显示
- 用expect 实现切换用户时自动输入密码 (转载)
- 《java核心技术》读书笔记(三)第三章 java基本的程序设计结构(2)