box(size)   =>  创造一个正方体

box(x,y,z) => 自定义矩形

rotateY 绕Y轴旋转

PI/6 == 30

float a = 0;
float r = 0;

void setup() {
  size(400, 400, P3D);
}

void draw() {
  background(80);
  // translate x,y,z
  translate(mouseX, mouseY, map(noise(a), 0, 1, -400, 300));
  rotateY(r);
  rotateX(PI/6);
  rotateZ(PI/6);
  // box => size
  box(50);
  a = a + 0.01;
  r = r + 0.02;
}




效果图如下:

Processing 入门教程(十九) 3D

相关文章:

  • 2021-06-08
  • 2021-07-22
  • 2021-11-22
  • 2021-09-14
  • 2021-06-21
  • 2021-11-12
猜你喜欢
  • 2021-06-08
  • 2021-09-22
  • 2021-10-13
  • 2021-05-03
  • 2022-01-05
  • 2021-08-09
  • 2021-09-11
相关资源
相似解决方案