//Stereogram test #1 //(C) 2004 Haruka Kataoka //phase float phase; float vp = 0.1; void setup() { size(300,200); phase = 0.0; framerate(30); stroke(127,127,255); fill(127,127,255); } void loop() { background(255,255,255); display(phase); phase += vp; } //表示 void display(float phase) { int lt = 75, rt = 225; //左画面と右画面の中心軸 int b = 5; //四角の大きさ int x = (int)(cos(phase) * 50); //左右の位置 int z = (int)(sin(phase) * 8); //飛び出し具合 float zm = 1.0+(sin(phase) / 3.0); //四角の大きさのズーム率 //clockwise rect(lt+x-b+z, 10-b, 2*b, 2*b); rect(rt+x-b-z, 10-b, 2*b, 2*b); //on plane rect(lt+x-b , 40-b, 2*b, 2*b); rect(rt+x-b , 40-b, 2*b, 2*b); //counter rect(lt+x-b-z, 70-b, 2*b, 2*b); rect(rt+x-b+z, 70-b, 2*b, 2*b); //zoomed b = (int)(zm * (float)b); //zoomed: on plane rect(lt+x-b , 100-b, 2*b, 2*b); rect(rt+x-b , 100-b, 2*b, 2*b); //zoomed: clockwise rect(lt+x-b+z, 130-b, 2*b, 2*b); rect(rt+x-b-z, 130-b, 2*b, 2*b); //zoomed: counter rect(lt+x-b-z, 170-b, 2*b, 2*b); rect(rt+x-b+z, 170-b, 2*b, 2*b); }