

3D 코드 그리기
노이즈 지형 그리기
float xnoise = 0.0;
float ynoise = 0.0;
float inc = 0.05;
float yOffset = 0.0;
int gridSize = 10;
void setup() {
size(600, 600, P3D);
}
void draw() {
background(255, 150, 0);
xnoise = 00;
ynoise = yOffset;
translate(0, 120, -300);
rotateX(0.7);
for(int y = 0; y < 60; y++) {
noFill();
beginShape();
for (int x = 0; x < 60; x++) {
float z = noise(xnoise, ynoise)* 255.5;
float alpha = map(y, 0, 60, 0, 255);
stroke(255, alpha);
vertex(x*gridSize, y*gridSize, z);
xnoise = xnoise + inc;
}
xnoise = 0.0;
ynoise = ynoise + inc;
endShape();
}
yOffset += inc/6.0;
saveFrame("frame_01/####.png");
}


키스톤 스크린에서 마우스 커서에 따라가는 공
import deadpixel.keystone.*;
Keystone ks;
CornerPinSurface surface;
PGraphics offscreen;
void setup(){
size(800, 600, P3D);
ks = new Keystone(this);
surface = ks.createCornerPinSurface(400, 300, 20);
offscreen = createGraphics(400, 300, P3D);
}
void draw() {
PVector surfaceMouse = surface.getTransformedMouse();
offscreen.beginDraw();
offscreen.background(255);
offscreen.fill(0, 255, 0);
offscreen.ellipse(surfaceMouse.x, surfaceMouse.y, 75, 75);
offscreen.endDraw();
background(0);
surface.render(offscreen);
saveFrame("frame_01/####.png");
}
void keyPressed(){
switch(key) {
case 'c':
ks.toggleCalibration();
break;
case'l':
ks.load();
break;
case 's':
ks.save();
break;
}
}

Keystone codes
import deadpixel.keystone.*;
Keystone ks;
CornerPinSurface surface1, surface2;
PGraphics offscreen1, offscreen2;
int x1=0;
int x2=0;
void setup(){
size(1280, 720, P3D);
ks = new Keystone(this);
surface1 = ks.createCornerPinSurface(600, 300, 20);
surface2 = ks.createCornerPinSurface(600, 300, 20);
offscreen1 = createGraphics(600, 300, P3D);
offscreen2 = createGraphics(600, 300, P3D);
}
void draw(){
offscreen1.beginDraw();
offscreen1.strokeWeight(5);
offscreen1.fill(1, 1, 20, 30);
offscreen1.rect(0, 0, 600, 300);
offscreen1.stroke(100, 100, 255);
offscreen1.line(x1, 0, x1, 300);
offscreen1.strokeWeight(1);
offscreen1.stroke(255);
offscreen1.line(x1, 0, x1, 300);
x1 += 2;
if (x1>=600) {
x1=0;
offscreen1.background(255);
}
offscreen1.endDraw();
offscreen2.beginDraw();
offscreen2.strokeWeight(5);
offscreen2.fill(20, 1, 1, 30);
offscreen2.rect(0, 0, 600, 300);
offscreen2.stroke(255, 100, 100);
offscreen2.line(x2, 0, x2, 300);
offscreen2.strokeWeight(1);
offscreen2.stroke(255);
offscreen2.line(x2, 0, x2, 300);
x2 -= 2;
if (x2<=0) {
x2=600;
offscreen2.background(255);
}
offscreen2.endDraw();
background(0);
surface1.render(offscreen1);
surface2.render(offscreen2);
saveFrame("frame_01/####.png");
}
void keyPressed(){
switch(key) {
case 'c':
ks.toggleCalibration();
case 'l':
ks.load();
break;
case 's':
ks.save();
break;
}
}
