loadfile1.pde

来自「This is processing for java examples.」· PDE 代码 · 共 31 行

PDE
31
字号
/** * LoadFile 1 *  * Loads a text file that contains two numbers separated by a tab ('\t'). * A new pair of numbers is loaded each frame and used to draw a point on the screen. */String[] lines;int index = 0;void setup() {  size(200, 200);  background(0);  stroke(255);  frameRate(12);  lines = loadStrings("positions.txt");}void draw() {  if (index < lines.length) {    String[] pieces = split(lines[index], '\t');    if (pieces.length == 2) {      int x = int(pieces[0]) * 2;      int y = int(pieces[1]) * 2;      point(x, y);    }    // Go to the next line for the next run through draw()    index = index + 1;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?