the first meet with Processing

一个强大的东西 http://processing.org/

Processing是一个用于生成图像、动画、交互的开源编程语言。。。

 

 

the first meet with Processing

 

void setup() {
  size(width, height);
  background(256, 256, 256);
  stroke(0, 128, 0);
  smooth();
  frameRate(24);
}

// float GOLD = 0.618;

int width = 300;
int height = 150;

int a = 100;
float b = 10;

int left = width;
int right;

boolean sign = true;

void draw() {  
  if (sign) {
    int tmp = (int)(left * (a - b) / a);
    right = width - tmp;
    line(width - left, 0, right, height);
    
    left = tmp;
  } else {
    line(right, height, right, 0);
  } 
  
  sign = !sign;
  if (left < 0) {
    noLoop();
  }
}

你可能感兴趣的:(编程)