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

📄 rgbcube.pde

📁 This is processing for java examples.
💻 PDE
字号:
/** * RGB Cube. *  * The three primary colors of the additive color model are red, green, and blue. * This RGB color cube displays smooth transitions between these colors.  */ float xmag, ymag = 0;float newXmag, newYmag = 0;  void setup() {   size(640, 360, P3D);   noStroke();   colorMode(RGB, 1); }  void draw() {   background(0.5);    pushMatrix();    translate(width/2, height/2, -30);     newXmag = mouseX/float(width) * TWO_PI;  newYmag = mouseY/float(height) * TWO_PI;    float diff = xmag-newXmag;  if (abs(diff) >  0.01) { xmag -= diff/4.0; }    diff = ymag-newYmag;  if (abs(diff) >  0.01) { ymag -= diff/4.0; }    rotateX(-ymag);   rotateY(-xmag);     scale(90);  beginShape(QUADS);  fill(0, 1, 1); vertex(-1,  1,  1);  fill(1, 1, 1); vertex( 1,  1,  1);  fill(1, 0, 1); vertex( 1, -1,  1);  fill(0, 0, 1); vertex(-1, -1,  1);  fill(1, 1, 1); vertex( 1,  1,  1);  fill(1, 1, 0); vertex( 1,  1, -1);  fill(1, 0, 0); vertex( 1, -1, -1);  fill(1, 0, 1); vertex( 1, -1,  1);  fill(1, 1, 0); vertex( 1,  1, -1);  fill(0, 1, 0); vertex(-1,  1, -1);  fill(0, 0, 0); vertex(-1, -1, -1);  fill(1, 0, 0); vertex( 1, -1, -1);  fill(0, 1, 0); vertex(-1,  1, -1);  fill(0, 1, 1); vertex(-1,  1,  1);  fill(0, 0, 1); vertex(-1, -1,  1);  fill(0, 0, 0); vertex(-1, -1, -1);  fill(0, 1, 0); vertex(-1,  1, -1);  fill(1, 1, 0); vertex( 1,  1, -1);  fill(1, 1, 1); vertex( 1,  1,  1);  fill(0, 1, 1); vertex(-1,  1,  1);  fill(0, 0, 0); vertex(-1, -1, -1);  fill(1, 0, 0); vertex( 1, -1, -1);  fill(1, 0, 1); vertex( 1, -1,  1);  fill(0, 0, 1); vertex(-1, -1,  1);  endShape();    popMatrix(); } 

⌨️ 快捷键说明

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