//week15_01
void setup()
{
size(300,200);
background(255,0,0);
WindowB child = new WindowB();
}
void draw()
{
}
class WindowB extends PApplet
{
public WindowB()
{
super();
PApplet.runSketch(new String[]{this.getClass().getName()},this);
}
public void settings()
{
size(300,200);
}
public void setup()
{
background(0,255,0);
}
public void draw()
{}
}
//week15_2
PGraphics pg;
void setup()
{
size(400,400,P3D);
pg = createGraphics(200,200,P3D);
}
void draw()
{
background(255,0,0);
pg.beginDraw();
pg.background(0,255,0);
pg.translate(100,100);
pg.rotateY(radians(frameCount));
pg.box(100);
pg.endDraw();
image(pg,0,0);
}
//week15_3
PGraphics pg,pg2,pg3,pg4;
void setup()
{
size(400,400,P3D);
pg = createGraphics(200,200,P3D);
pg2 = createGraphics(200,200,P3D);
pg3 = createGraphics(200,200,P3D);
pg4 = createGraphics(200,200,P3D);
}
void draw()
{
pg.beginDraw();
pg.background(0,255,0);
pg.translate(100,100);
pg.rotateY(radians(frameCount));
pg.box(100);
pg.endDraw();
pg2.beginDraw();
pg2.background(255,255,0);
pg2.translate(100,100);
pg2.rotateY(radians(frameCount));
pg2.box(100);
pg2.endDraw();
background(255,0,0);
pg3.beginDraw();
pg3.background(255,0,0);
pg3.translate(100,100);
pg3.rotateY(radians(frameCount));
pg3.box(100);
pg3.endDraw();
pg4.beginDraw();
pg4.background(255,0,255);
pg4.translate(100,100);
pg4.rotateY(radians(frameCount));
pg4.box(100);
pg4.endDraw();
image(pg,0,0);
image(pg2,200,0);
image(pg3,0,200);
image(pg4,200,200);
}
//week15_4
PGraphics pg,pg2,pg3,pg4;
Arcball arcball;
void setup()
{
arcball = new Arcball(this,200);
size(400,400,P3D);
pg = createGraphics(200,200,P3D);
pg2 = createGraphics(200,200,P3D);
pg3 = createGraphics(200,200,P3D);
pg4 = createGraphics(200,200,P3D);
}
void mousePressed() {
arcball.mousePressed();
}
void mouseDragged() {
arcball.mouseDragged();
}
void draw()
{
pg.beginDraw();
pg.background(0,255,0);
arcball.run();
//pg.translate(100,100);
//pg.rotateY(radians(frameCount));
pg.box(100);
pg.endDraw();
pg2.beginDraw();
pg2.background(255,255,0);
pg2.translate(100,100);
pg2.rotateY(radians(frameCount));
pg2.box(100);
pg2.endDraw();
background(255,0,0);
pg3.beginDraw();
pg3.background(255,0,0);
pg3.translate(100,100);
pg3.rotateY(radians(frameCount));
pg3.box(100);
pg3.endDraw();
pg4.beginDraw();
pg4.background(255,0,255);
pg4.translate(100,100);
pg4.rotateY(radians(frameCount));
pg4.box(100);
pg4.endDraw();
image(pg,0,0);
image(pg2,200,0);
image(pg3,0,200);
image(pg4,200,200);
}
沒有留言:
張貼留言