2025年3月13日 星期四

12750423_week04

//week04_8

void setup()

{

  size(400,400,P3D);

}


void draw()

{

  background(128);

  translate(width/2,height/2);

  sphere(50);

  rotateY(radians(frameCount));

  pushMatrix();

    translate(150,0);

    rotateY(radians(frameCount));

    sphere(30);

    pushMatrix();

      translate(50,0);

      rotateY(radians(frameCount));

      sphere(10);

    popMatrix();

  popMatrix();




//week04_9

PImage img = loadImage("earth.jpg");

size(600,300);

image(img,0,0,600,300);

//week04_10

size(400,400,P3D);

PShape earth = createShape(SPHERE,100);

PImage img = loadImage("earth.jpg"); 

earth.setTexture(img);

shape(earth);


//week04_11

PShape earth;

void setup()

{

  size(400,400,P3D);

  earth = createShape(SPHERE,100);

  PImage img = loadImage("earth.jpg"); 

  earth.setTexture(img);

}

void draw()

{

  background(0);

  translate(width/2,height/2);

  rotateY(radians(frameCount));

  shape(earth);

}




//week04_12
PShape moon;
void setup()
{
  size(400,400,P3D);
  moon = createShape(SPHERE,100);
  PImage img = loadImage("moon.jpg"); 
  moon.setTexture(img);
}
void draw()
{
  background(0);
  translate(width/2,height/2);
  rotateY(radians(frameCount));
  shape(moon);
}



//week04_13

PShape sun;

void setup()

{

  size(400,400,P3D);

  sun = createShape(SPHERE,100);

  PImage img = loadImage("sun.jpg"); 

  sun.setTexture(img);

}

void draw()

{

  background(0);

  translate(width/2,height/2);

  rotateY(radians(frameCount));

  shape(sun);

}




//week04_14

PShape sun,earth,moon;

void setup()

{

  size(400,400,P3D);

  sun = createShape(SPHERE,100);

  PImage img = loadImage("sun.jpg"); 

  sun.setTexture(img);

  

  size(400,400,P3D);

  earth = createShape(SPHERE,30);

  img = loadImage("earth.jpg"); 

  earth.setTexture(img);

  

  size(400,400,P3D);

  moon = createShape(SPHERE,10);

  img = loadImage("moon.jpg"); 

  moon.setTexture(img); 

}


void draw()

{

  background(128);

  translate(width/2,height/2);

  shape(sun);

  rotateY(radians(frameCount));

  pushMatrix();

    translate(150,0);

    rotateY(radians(frameCount));

    shape(earth);

    pushMatrix();

      translate(50,0);

      rotateY(radians(frameCount));

      shape(moon);

    popMatrix();

  popMatrix();

}





沒有留言:

張貼留言