⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 birds.pde

📁 This is processing for java examples.
💻 PDE
字号:
/** * Crazy Flocking 3D Birds  * by Ira Greenberg.  *  * Simulates a flock of birds using a Bird class and nested * pushMatrix() / popMatrix() functions.  * Trigonometry functions handle the flapping and sinuous movement. */// Flock arrayint birdCount = 200;Bird[]birds = new Bird[birdCount];float[]x = new float[birdCount];float[]y = new float[birdCount];float[]z = new float[birdCount];float[]rx = new float[birdCount];float[]ry = new float[birdCount];float[]rz = new float[birdCount];float[]spd = new float[birdCount];float[]rot = new float[birdCount];void setup() {  size(640, 360, P3D);  noStroke();  // Initialize arrays with random values  for (int i = 0; i < birdCount; i++){    birds[i] = new Bird(random(-300, 300), random(-300, 300),                random(-500, -2500), random(5, 30), random(5, 30));     x[i] = random(20, 340);    y[i] = random(30, 350);    z[i] = random(1000, 4800);    rx[i] = random(-160, 160);    ry[i] = random(-55, 55);    rz[i] = random(-20, 20);    spd[i] = random(.1, 3.75);    rot[i] = random(.025, .15);  }}void draw() {  background(0);  lights();  for (int i = 0; i < birdCount; i++){    birds[i].setFlight(x[i], y[i], z[i], rx[i], ry[i], rz[i]);    birds[i].setWingSpeed(spd[i]);    birds[i].setRotSpeed(rot[i]);    birds[i].fly();  }}

⌨️ 快捷键说明

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