top of page

색자판 무비메이커 버전

/**

 * Keyboard Functions 

 * by Martin Gomez 

 * 

 * Click on the window to give it focus and press the letter keys to type colors. 

 * The keyboard function keyPressed() is called whenever

 * a key is pressed. keyReleased() is another keyboard

 * function that is called when a key is released.

 * 

 * Original 'Color Typewriter' concept by John Maeda. 

 */

 

int maxHeight = 40;

int minHeight = 20;

int letterHeight = maxHeight; // Height of the letters

int letterWidth = 20;          // Width of the letter

 

int x = -letterWidth;          // X position of the letters

int y = 0;                      // Y position of the letters

 

boolean newletter;              

 

int numChars = 26;      // There are 26 characters in the alphabet

color[] colors = new color[numChars];

 

void setup() {

  size(640, 360);

  noStroke();

  colorMode(HSB, numChars);

  background(numChars/2);

  // Set a hue value for each key

  for(int i = 0; i < numChars; i++) {

    colors[i] = color(i, numChars, numChars);    

  }

}

 

void draw() {

  if(newletter == true) {

    // Draw the "letter"

    int y_pos;

    if (letterHeight == maxHeight) {

      y_pos = y;

      rect( x, y_pos, letterWidth, letterHeight );

    } else {

      y_pos = y + minHeight;

      rect( x, y_pos, letterWidth, letterHeight );

      fill(numChars/2);

      rect( x, y_pos-minHeight, letterWidth, letterHeight );

      saveFrame("frame_01/####.png");

    }

    newletter = false;

  }

}

 

void keyPressed()

{

  // If the key is between 'A'(65) to 'Z' and 'a' to 'z'(122)

  if((key >= 'A' && key <= 'Z') || (key >= 'a' && key <= 'z')) {

    int keyIndex;

    if(key <= 'Z') {

      keyIndex = key-'A';

      letterHeight = maxHeight;

      fill(colors[keyIndex]);

    } else {

      keyIndex = key-'a';

      letterHeight = minHeight;

      fill(colors[keyIndex]);

    }

  } else {

    fill(0);

    letterHeight = 10;

  }

 

  newletter = true;

 

  // Update the "letter" position

  x = ( x + letterWidth ); 

 

  // Wrap horizontally

  if (x > width - letterWidth) {

    x = 0;

    y+= maxHeight;

  }

 

  // Wrap vertically

  if( y > height - letterHeight) {

    y = 0;      // reset y to 0

}

}

​커서 누른상태에서 검은선으로 드로잉
(-버튼 누르면 선 얇아짐,
=버튼 누르면 선 굵어짐)

int brushSize;

 

void setup() {

  size(500, 500);

  background(255);

  

  

  brushSize = 40;

  

}

 

void draw() {

  

  if (mousePressed){

  stroke(0);

  //fill(0);

  //ellipse(mouseX, mouseY, brushSize, brushSize);

 strokeWeight(brushSize);

 line(pmouseX, pmouseY, mouseX, mouseY);

 }

}

 

void keyPressed(){

 if (key == '-'){

   brushSize -= 5;

 } else if (key == '=') {

 brushSize += 5;

 }

 brushSize = constrain(brushSize, 5, 100);

 

 

}

색 건반처럼 변화하는 무비메이커

/**

 * Hue. 

 * 

 * Hue is the color reflected from or transmitted through an object 

 * and is typically referred to as the name of the color such as 

 * red, blue, or yellow. In this example, move the cursor vertically 

 * over each bar to alter its hue. 

 */

 

int barWidth = 20;

int lastBar = -1;

 

void setup() {

  size(640, 360);

  colorMode(HSB, height, height, height);  

  noStroke();

  background(0);

}

 

void draw() {

  int whichBar = mouseX / barWidth;

  if (whichBar != lastBar) {

    int barX = whichBar * barWidth;

    fill(mouseY, height, height);

    rect(barX, 0, barWidth, height);

    lastBar = whichBar;

    saveFrame("frame_01/####.png");

  }

}

색 건반 무지개색 무비메이커

/**

 * Brightness 

 * by Rusty Robison. 

 * 

 * Brightness is the relative lightness or darkness of a color.

 * Move the cursor vertically over each bar to alter its brightness. 

 */

 

int barWidth = 20;

int lastBar = -1;

 

void setup() {

  size(640, 360);

  colorMode(HSB, width, 100, height);

  noStroke();

  background(0);

}

 

void draw() {

  int whichBar = mouseX / barWidth;

  if (whichBar != lastBar) {

    int barX = whichBar * barWidth;

    fill(barX, 100, mouseY);

    rect(barX, 0, barWidth, height);

    lastBar = whichBar;

     saveFrame("frame_01/####.png");

  }

}

변하는 배경에 ​커서를 따라다니는 원

void setup() {

  size(400, 400);

}

 

void draw() {

  background(mouseX, mouseY, 0);

  noStroke();

  fill(mouseX, mouseX, mouseY);

  ellipse(mouseX, mouseY, mouseY/4, mouseY/4);

  

}

연두색 배경에 빨간 원 드로잉

void setup(){

  size(1024,768);

  background(0,255,0);

}

 

void draw(){

  ellipse(mouseX, mouseY,100,100);

  fill(255,0,0);

  saveFrame("frame_01/####.png");

  

}

​연두색 배경에 노,흰,파랑 원 드로잉

void setup(){

  size(1024,768);

  background(0,255,0);

}

 

void draw(){

  ellipse(mouseX, mouseY,100,100);

  fill(mouseX, mouseX, mouseY);

  saveFrame("frame_01/####.png");

  

}

커서 누른상태에서 스페이스바 누를 때마다 무지개색으로 드로잉
(-버튼 누르면 선 얇아짐,
=버튼 누르면 선 굵어짐) 

int brushSize;

color brushCol; 

 

void setup() {

  size(500, 500);

  background(255);

  

  

  brushSize = 40;

  

}

 

void draw() {

  

  if (mousePressed){

  stroke (brushCol);

  //fill(0);

  //ellipse(mouseX, mouseY, brushSize, brushSize);

 strokeWeight(brushSize);

 line(pmouseX, pmouseY, mouseX, mouseY);

 }

}

 

void keyPressed(){

 if (key == '-'){ // decrease brush size

   brushSize -= 5;

 } else if (key == '=') { // increse brush size

 brushSize += 5;

 } else if (key == 'r') { // refresh screen

 background(255);

 } else if (key == ' ') {

   brushCol = color ( random(255), random(255), random(255));

saveFrame("frame_01/####.png");

 }

 brushSize = constrain(brushSize, 5, 100);

 

 

}

​2개의 탭으로 볼게임 만드는 코드

1번

ball myBall = new ball(250, 250, 16, #FE00FF);

 

int x_dir = 1;

int y_dir = 1;

 

void setup(){

  size(500, 500);

}

 

void draw(){

 background(#00FFE8);

 if(myBall.x>=500-12){

  x_dir *= -1; 

 }

 if(myBall.x<=0+12){

  x_dir *= -1; 

 }

 if(myBall.y>=500-12){

  y_dir *= -1; 

 }

 if(myBall.y<=0+12){

  y_dir *= -1; 

 }

 myBall.ball_move(4*x_dir, 6*y_dir);

 delay(10);

 saveFrame("frame_01/####.png");

}

​2번

class ball{

int x, y, r;

color c;

 

ball(int x, int y, int r, color c){

this.x = x;

this.y = y;

this.r = r;

this.c = c;

}

 

void ball_move(int x, int y){

  this.x += x;

  this.y += y;

  ball_draw();

}

 

  void ball_draw(){

   fill(c);

   ellipse(x, y, r, r);

  }

}

​2개의 탭으로 볼 게임을 만들기

1번_볼 게임 만들기

ball myBall = new ball(250, 250, 16, #FE00FF);

 bar myBar = new bar(250, 450, 80, 6);

 

int x_dir = 1;

int y_dir = 1;

 

void setup(){

  size(500, 500);

}

 

void draw(){

 background(#00FFE8);

 wall_bounce();

 bar_bounce();

 myBall.ball_move(4*x_dir, 6*y_dir);

 myBar. bar_move(mouseX);

 delay(10);

}

void bar_bounce(){

  if((myBar.x-40<=myBall.x+9)&&(myBar.x+40>=myBall.x-9)){

    if((myBar.y-3<=myBall.y+9)&&(myBar.y+3>=myBall.y-9)){

      y_dir*=-1;

    }

  }

}

 

 

void wall_bounce(){

  if(myBall.x>=500-12){

  x_dir *= -1; 

 }

 if(myBall.x<=0+12){

  x_dir *= -1; 

 }

 if(myBall.y>=500-12){

  y_dir *= -1; 

 }

 if(myBall.y<=0+12){

  y_dir *= -1; 

 }

}

​2번_볼 게임 만들기

class ball{

int x, y, r;

color c;

 

ball(int x, int y, int r, color c){

this.x = x;

this.y = y;

this.r = r;

this.c = c;

}

 

void ball_move(int x, int y){

  this.x += x;

  this.y += y;

  ball_draw();

}

 

  void ball_draw(){

    strokeWeight(1);

   fill(c);

   ellipse(x, y, r, r);

  }

}

 

 

class bar {

 int x, y, len, wei; 

  bar(int x, int y, int len, int wei) {

    this.x = x;

    this.y = y;

    this.len = len;

    this.wei = wei;

  }

  

  void bar_draw(){

  strokeWeight(wei);

  line(x-(len/2), y, x+(len/2), y);

  }

  void bar_move(int x){

   this.x = x; 

   bar_draw();

  }

}

​2개의 탭으로 벽돌 깨기 게임 만들기

1번_벽돌 깨기 게임 만들기

ball myBall = new ball(250, 250, 16, #FFB30D);

 bar myBar = new bar(250, 450, 80, 6);

target myTarget = new target(#0DFF8C);

int x_dir = 1;

int y_dir = 1;

int target_f = 0;

int score = 0;

void setup(){

  size(500, 500);

  myTarget.target_pos(200, 200);

}

 

void draw(){

 background(#B0F0FC);

 wall_bounce();

 bar_bounce();

 target_bounce();

 

 myBall.ball_move(4*x_dir, 6*y_dir);

 myBar. bar_move(mouseX);

}

 

void target_bounce(){

  if (target_f==0){

myTarget.target_pos(int(random(450)), int(random(280)));

target_f=1;  

}

if ((myTarget.x<=myBall.x+16)&&(myTarget.x+50>=myBall.x+16)&&(myTarget.y<=myBall.y)&&(myTarget.y+20>=myBall.y)){

  target_f=0;

  x_dir*=-1;

  score+=100;

}

if ((myTarget.x<=myBall.x-16)&&(myTarget.x+50>=myBall.x-16)&&(myTarget.y<=myBall.y)&&(myTarget.y+20>=myBall.y)){

  target_f=0;

  x_dir*=-1;

  score+=100;

}

if ((myTarget.x<=myBall.x)&&(myTarget.x+50>=myBall.x)&&(myTarget.y<=myBall.y-16)&&(myTarget.y+20>=myBall.y-16)){

  target_f=0;

  y_dir*=-1;

  score+=100;

}

if ((myTarget.x<=myBall.x)&&(myTarget.x+50>=myBall.x)&&(myTarget.y<=myBall.y+16)&&(myTarget.y+20>=myBall.y+16)){

  target_f=0;

  y_dir*=-1;

  score+=100;

}

fill(#FF0D15);

textSize(50);

text(score, 150, 500);

myTarget.target_draw();

}

 

 

void bar_bounce(){

  if((myBar.x-40<=myBall.x+9)&&(myBar.x+40>=myBall.x-9)){

    if((myBar.y-3<=myBall.y+9)&&(myBar.y+3>=myBall.y-9)){

      y_dir*=-1;

    }

  }

}

 

 

void wall_bounce(){

  if(myBall.x>=500-12){

  x_dir *= -1; 

 }

 if(myBall.x<=0+12){

  x_dir *= -1; 

 }

 if(myBall.y>=500-12){

  y_dir *= -1; 

  score=0;

 }

 if(myBall.y<=0+12){

  y_dir *= -1; 

 }

}

2번_벽돌 깨기 게임 만들기

class ball{

int x, y, r;

color c;

 

ball(int x, int y, int r, color c){

this.x = x;

this.y = y;

this.r = r;

this.c = c;

}

 

void ball_move(int x, int y){

  this.x += x;

  this.y += y;

  ball_draw();

}

 

  void ball_draw(){

    strokeWeight(1);

   fill(c);

   ellipse(x, y, r, r);

  }

}

 

 

class bar {

 int x, y, len, wei; 

  bar(int x, int y, int len, int wei) {

    this.x = x;

    this.y = y;

    this.len = len;

    this.wei = wei;

  }

  

  void bar_draw(){

  strokeWeight(wei);

  line(x-(len/2), y, x+(len/2), y);

  }

  void bar_move(int x){

   this.x = x; 

   bar_draw();

  }

}

 

class target{

 int x, y;

 color c;

 target(color c){

 this. c = c;

 }

 void target_pos(int x, int y){

   this.x = x;

   this.y = y;

 }

 void target_draw(){

   strokeWeight(1);

   fill(c);

   rect(x, y, 50, 20);

 }

}

​2개의 탭으로 벽돌 깨기 게임 만들기 2

1번_벽돌 깨기 게임 만들기2

ball myBall = new ball(250, 250, 16, #2385FA);

 bar myBar = new bar(250, 450, 120, 6);

target myTarget = new target(#0DFF8C);

int x_dir = 1;

int y_dir = 1;

int x_speed = 4;

int y_speed = 6;

int target_f = 0;

int score = 0;

void setup(){

  size(500, 500);

  myTarget.target_pos(200, 200);

}

 

void draw(){

 background(#FFBE6A);

 wall_bounce();

 bar_bounce();

 target_bounce();

 

 myBall.ball_move(x_speed*x_dir, y_speed*y_dir);

 myBar. bar_move(mouseX);

}

 

void target_bounce(){

  if (target_f==0){

myTarget.target_pos(int(random(450)), int(random(280)));

target_f=1;  

}

if ((myTarget.x<=myBall.x+16)&&(myTarget.x+50>=myBall.x+16)&&(myTarget.y<=myBall.y)&&(myTarget.y+20>=myBall.y)){

  target_f=0;

  x_dir*=-1;

  score+=100;

}

if ((myTarget.x<=myBall.x-16)&&(myTarget.x+50>=myBall.x-16)&&(myTarget.y<=myBall.y)&&(myTarget.y+20>=myBall.y)){

  target_f=0;

  x_dir*=-1;

  score+=100;

}

if ((myTarget.x<=myBall.x)&&(myTarget.x+50>=myBall.x)&&(myTarget.y<=myBall.y-16)&&(myTarget.y+20>=myBall.y-16)){

  target_f=0;

  y_dir*=-1;

  score+=100;

}

if ((myTarget.x<=myBall.x)&&(myTarget.x+50>=myBall.x)&&(myTarget.y<=myBall.y+16)&&(myTarget.y+20>=myBall.y+16)){

  target_f=0;

  y_dir*=-1;

  score+=100;

}

fill(#FF0D15);

textSize(50);

text(score, 150, 500);

myTarget.target_draw();

}

 

 

void bar_bounce(){

  if((myBar.x-(myBar.len/2)<=myBall.x+9)&&(myBar.x+(myBar.len/2)>=myBall.x-9)){

    if((myBar.y-3<=myBall.y+9)&&(myBar.y+3>=myBall.y-9)){

      y_dir*=-1;

      if(myBar.x-(myBar.len/2)+(myBar.len/8)>=myBall.x){

        x_dir=-1;

        x_speed=4;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*2>=myBall.x){

        x_dir=-1;

        x_speed=3;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*3>=myBall.x){

        x_dir=-1;

        x_speed=2;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*4>=myBall.x){

        x_dir=-1;

        x_speed=1;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*5>=myBall.x){

        x_dir=1;

        x_speed=1;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*6>=myBall.x){

        x_dir=1;

        x_speed=2;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*7>=myBall.x){

        x_dir=1;

        x_speed=3;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*7<=myBall.x){

        x_dir=1;

        x_speed=4;

      }

    }

  }

}

 

 

void wall_bounce(){

  if(myBall.x>=500-12){

  x_dir *= -1; 

 }

 if(myBall.x<=0+12){

  x_dir *= -1; 

 }

 if(myBall.y>=500-12){

  y_dir *= -1; 

  score=0;

 }

 if(myBall.y<=0+12){

  y_dir *= -1; 

 }

}

​2번_벽돌 깨기 게임 만들기2

class ball{

int x, y, r;

color c;

 

ball(int x, int y, int r, color c){

this.x = x;

this.y = y;

this.r = r;

this.c = c;

}

 

void ball_move(int x, int y){

  this.x += x;

  this.y += y;

  ball_draw();

}

 

  void ball_draw(){

    strokeWeight(1);

   fill(c);

   ellipse(x, y, r, r);

  }

}

 

 

class bar {

 int x, y, len, wei; 

  bar(int x, int y, int len, int wei) {

    this.x = x;

    this.y = y;

    this.len = len;

    this.wei = wei;

  }

  

  void bar_draw(){

  strokeWeight(wei);

  line(x-(len/2), y, x+(len/2), y);

  }

  void bar_move(int x){

   this.x = x; 

   bar_draw();

  }

}

 

class target{

 int x, y;

 color c;

 target(color c){

 this. c = c;

 }

 void target_pos(int x, int y){

   this.x = x;

   this.y = y;

 }

 void target_draw(){

   strokeWeight(1);

   fill(c);

   rect(x, y, 50, 20);

 }

}

​2개의 탭으로 벽돌 깨기 게임 만들기 3 (완성)

1번_벽돌 깨기 게임 만들기3

​2번_벽돌 깨기 게임 만들기3

ball myBall = new ball(250, 250, 16, #FF038A);

 bar myBar = new bar(250, 450, 120, 6);

target myTarget = new target(#FFC903);

boolean play = false;

boolean main = true;

boolean end = false;

int basic_speed = 6;

 

int x_dir = 1;

int y_dir = 1;

int x_speed = 0;

int y_speed = basic_speed;

int target_f = 0;

int score = 0;

 

void setup(){

  size(500, 500);

  myTarget.target_pos(200, 200);

}

 

void draw(){

 background(#D3FF67);

 

 if (play){

 wall_bounce();

 bar_bounce();

 target_bounce();

 

 myBall.ball_move(x_speed*x_dir, y_speed*y_dir);

 myBar. bar_move(mouseX);  

 }

 if(main){

   if(mousePressed){

     play = true;

     main = false;

     end = false;

     init_game();

   }

   textSize(40);

   fill(#5A5959);

   text("Please press mouse.", 50, 250);

 }

 if(end){

   if(mousePressed){

     play = false;

     main = true;

     end = false;

     delay(300);

   }

   textSize(40);

   fill(#5A5959);

   text(score, 50, 250);

 }

saveFrame("frame_01/####.png");

}

 

void target_bounce(){

  if (target_f==0){

myTarget.target_pos(int(random(450)), int(random(280)));

target_f=1;  

}

if ((myTarget.x<=myBall.x+16)&&(myTarget.x+50>=myBall.x+16)&&(myTarget.y<=myBall.y)&&(myTarget.y+20>=myBall.y)){

  target_f=0;

  x_dir*=-1;

  score+=100;

}

if ((myTarget.x<=myBall.x-16)&&(myTarget.x+50>=myBall.x-16)&&(myTarget.y<=myBall.y)&&(myTarget.y+20>=myBall.y)){

  target_f=0;

  x_dir*=-1;

  score+=100;

}

if ((myTarget.x<=myBall.x)&&(myTarget.x+50>=myBall.x)&&(myTarget.y<=myBall.y-16)&&(myTarget.y+20>=myBall.y-16)){

  target_f=0;

  y_dir*=-1;

  score+=100;

}

if ((myTarget.x<=myBall.x)&&(myTarget.x+50>=myBall.x)&&(myTarget.y<=myBall.y+16)&&(myTarget.y+20>=myBall.y+16)){

  target_f=0;

  y_dir*=-1;

  score+=100;

}

fill(#FF0D15);

textSize(50);

text(score, 150, 500);

y_speed = (score/300)+basic_speed;

text(y_speed, 400, 500);

myTarget.target_draw();

}

 

 

void bar_bounce(){

  if((myBar.x-(myBar.len/2)<=myBall.x+9)&&(myBar.x+(myBar.len/2)>=myBall.x-9)){

    if((myBar.y-3<=myBall.y+9)&&(myBar.y+3>=myBall.y-9)){

      y_dir*=-1;

      if(myBar.x-(myBar.len/2)+(myBar.len/8)>=myBall.x){

        x_dir=-1;

        x_speed=4;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*2>=myBall.x){

        x_dir=-1;

        x_speed=3;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*3>=myBall.x){

        x_dir=-1;

        x_speed=2;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*4>=myBall.x){

        x_dir=-1;

        x_speed=1;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*5>=myBall.x){

        x_dir=1;

        x_speed=1;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*6>=myBall.x){

        x_dir=1;

        x_speed=2;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*7>=myBall.x){

        x_dir=1;

        x_speed=3;

      }

      else if(myBar.x-(myBar.len/2)+(myBar.len/8)*7<=myBall.x){

        x_dir=1;

        x_speed=4;

      }

    }

  }

}

 

 

void wall_bounce(){

  if(myBall.x>=500-12){

  x_dir *= -1; 

 }

 if(myBall.x<=0+12){

  x_dir *= -1; 

 }

 if(myBall.y>=500-12){

  y_dir *= -1; 

  play = false;

  main = false;

  end = true;

 }

 if(myBall.y<=0+12){

  y_dir *= -1; 

 }

}

void init_game(){

  x_dir = 1;

  y_dir = 1;

  x_speed = 0;

  y_speed = basic_speed;

  target_f = 0;

  score = 0;

  myBall.x = 250;

  myBall.y = 250;

}

class ball{

int x, y, r;

color c;

 

ball(int x, int y, int r, color c){

this.x = x;

this.y = y;

this.r = r;

this.c = c;

}

 

void ball_move(int x, int y){

  this.x += x;

  this.y += y;

  ball_draw();

}

 

  void ball_draw(){

    strokeWeight(1);

   fill(c);

   ellipse(x, y, r, r);

  }

}

 

 

class bar {

 int x, y, len, wei; 

  bar(int x, int y, int len, int wei) {

    this.x = x;

    this.y = y;

    this.len = len;

    this.wei = wei;

  }

  

  void bar_draw(){

  strokeWeight(wei);

  line(x-(len/2), y, x+(len/2), y);

  }

  void bar_move(int x){

   this.x = x; 

   bar_draw();

  }

}

 

class target{

 int x, y;

 color c;

 target(color c){

 this. c = c;

 }

 void target_pos(int x, int y){

   this.x = x;

   this.y = y;

 }

 void target_draw(){

   strokeWeight(1);

   fill(c);

   rect(x, y, 50, 20);

 }

}

몬드리안 <빨강, 파랑, 노랑의 구성>코딩작품

void setup(){

  size(600, 600);

  background(255);

  noLoop();

}

 

void draw(){

 strokeWeight(20);

 fill(255, 255, 0);

  rect(10, 10, 180, 300);

  fill(255);

  rect(10, 310, 180, 170);

  fill(0, 0, 255);

  rect(10, 480, 180, 110);

  fill(255, 0, 0);

  rect(190, 10, 400, 470);

  fill(255);

  rect(190, 480, 290, 110);

  rect(480, 480, 110, 110);

}

페페로니 피자 코딩작품

void setup(){

  size(600, 600);

  background(255);

  noLoop();

}

 

void draw(){

  noStroke();

  fill(250, 230, 150);

  strokeWeight(10);

  stroke(210, 125, 20);

  fill(255, 240, 290);

  ellipse(300, 300, 420, 420);

  noStroke();

  fill(180, 0, 0);

  ellipse(340, 300, 60, 60);

  ellipse(440, 200, 60, 60);

  ellipse(350, 410, 60, 60);

  ellipse(220, 140, 60, 60);

  ellipse(150, 290, 60, 60);

  ellipse(200, 400, 60, 60);

  ellipse(320, 460, 60, 60);

  ellipse(420, 420, 60, 60);

  ellipse(480, 330, 60, 60);

  strokeWeight(5);

  stroke(30);

  ellipse(430, 270, 15, 15);

  ellipse(330, 240, 15, 15);

  ellipse(410, 160, 15, 15);

  ellipse(260, 130, 15, 15);

  ellipse(160, 160, 15, 15);

  ellipse(140, 370, 15, 15);

  ellipse(240, 360, 15, 15);

  ellipse(250, 460, 15, 15);

  ellipse(380, 450, 15, 15);

  ellipse(360, 380, 15, 15);

  noStroke();

  fill(250, 210, 20);

  ellipse(400, 280, 20, 20);

  ellipse(360, 230, 20, 20);

  ellipse(280, 120, 20, 20);

  ellipse(240, 210, 20, 20);

  ellipse(250, 280, 20, 20);

  ellipse(200, 330, 20, 20);

  ellipse(270, 340, 20, 20);

  ellipse(260, 430, 20, 20);

  ellipse(420, 360, 20, 20);

  fill(210, 220, 0);

  ellipse(350, 200, 10, 10);

  ellipse(280, 240, 10, 10);

  ellipse(230, 340, 10, 10);

  ellipse(360, 430, 10, 10);

  ellipse(390, 380, 10, 10);

}

커서 따라가는 눈동자 3개

Eye e1, e2, e3; void setup() { size(640, 360); noStroke(); e1 = new Eye( 250, 16, 120); e2 = new Eye( 164, 185, 80); e3 = new Eye( 420, 230, 220); } void draw() { background(102); e1.update(mouseX, mouseY); e2.update(mouseX, mouseY); e3.update(mouseX, mouseY); e1.display(); e2.display(); e3.display(); } class Eye { int x, y; int size; float angle = 0.0; Eye(int tx, int ty, int ts) { x = tx; y = ty; size = ts; } void update(int mx, int my) { angle = atan2(my-y, mx-x); } void display() { pushMatrix(); translate(x, y); fill(255); ellipse(0, 0, size, size); rotate(angle); fill(153, 204, 0); ellipse(size/4, 0, size/2, size/2); popMatrix(); } }

​피어나는 나무

float theta;   

 

void setup() {

  size(640, 360);

}

 

void draw() {

  background(0);

  frameRate(30);

  stroke(255);

  // Let's pick an angle 0 to 90 degrees based on the mouse position

  float a = (mouseX / (float) width) * 90f;

  // Convert it to radians

  theta = radians(a);

  // Start the tree from the bottom of the screen

  translate(width/2,height);

  // Draw a line 120 pixels

  line(0,0,0,-120);

  // Move to the end of that line

  translate(0,-120);

  // Start the recursive branching!

  branch(120);

 

}

 

void branch(float h) {

  // Each branch will be 2/3rds the size of the previous one

  h *= 0.66;

  

  // All recursive functions must have an exit condition!!!!

  // Here, ours is when the length of the branch is 2 pixels or less

  if (h > 2) {

    pushMatrix();    // Save the current state of transformation (i.e. where are we now)

    rotate(theta);   // Rotate by theta

    line(0, 0, 0, -h);  // Draw the branch

    translate(0, -h); // Move to the end of the branch

    branch(h);       // Ok, now call myself to draw two new branches!!

    popMatrix();     // Whenever we get back here, we "pop" in order to restore the previous matrix state

    

    // Repeat the same thing, only branch off to the "left" this time!

    pushMatrix();

    rotate(-theta);

    line(0, 0, 0, -h);

    translate(0, -h);

    branch(h);

    popMatrix();

  }

}

​커서 따라가는  움직임 잔상

int num = 60;

float mx[] = new float[num];

float my[] = new float[num];

 

void setup() {

  size(640, 360);

  noStroke();

  fill(255, 153); 

}

 

void draw() {

  background(51); 

  

  // Cycle through the array, using a different entry on each frame. 

  // Using modulo (%) like this is faster than moving all the values over.

  int which = frameCount % num;

  mx[which] = mouseX;

  my[which] = mouseY;

  

  for (int i = 0; i < num; i++) {

    // which+1 is the smallest (the oldest in the array)

    int index = (which+1 + i) % num;

    ellipse(mx[index], my[index], i, i);

  }

}

​무지개색 하트

void setup(){

  size(600, 600);

  background(255);

  frameRate(1);

}

 

void draw(){

  //fill(255, 0, 0);

  fill(random(255), random(255), random(255));

  beginShape();

  vertex(100, 200);

  bezierVertex(100, 60, 300, 60, 300, 200);

  bezierVertex(300, 60, 500, 60, 500, 200);

  bezierVertex(500, 300, 300, 400, 300, 500);

  bezierVertex(300, 400, 100, 300, 100, 200);

  endShape();

}

​커서 따라오는 아기상어

void setup() {

  size(600, 400);

  mouseX=width/2;

  mouseY=height/2;

}

 

void draw() {

  background(7, 155, 245);

  translate(mouseX-width/2, mouseY-height/2);

 

  noStroke();

  fill(250, 190, 0);

  beginShape();

  vertex(360, 120);

  bezierVertex(320, 80, 270, 50, 190, 70);

  bezierVertex(240, 100, 250, 130, 250, 150);

  bezierVertex(250, 150, 360, 120, 360, 120);

  endShape();

 

  fill(255);

  beginShape();

  vertex(440, 200);

  bezierVertex(440, 210, 460, 260, 480, 260);

  bezierVertex(360, 350, 230, 310, 110, 210);

  bezierVertex(110, 210, 440, 200, 440, 200);

  endShape();

 

  fill(255, 210, 30);

  beginShape();

  vertex(540, 160);

  bezierVertex(530, 150, 420, 110, 360, 110);

  bezierVertex(310, 110, 190, 180, 110, 170);

  bezierVertex(100, 120, 50, 100, 30, 100);

  bezierVertex(60, 130, 70, 210, 60, 250);

  bezierVertex(80, 250, 110, 220, 110, 210);

  bezierVertex(140, 230, 200, 250, 250, 260);

  bezierVertex(250, 270, 240, 310, 240, 320);

  bezierVertex(280, 310, 310, 280, 320, 270);

  bezierVertex(370, 270, 430, 230, 440, 200);

  bezierVertex(450, 210, 480, 230, 500, 240);

  bezierVertex(520, 220, 540, 170, 540, 160);

  endShape();

 

  if (mousePressed==true) {

    strokeWeight(2);

    stroke(30);

    line(366, 150, 414, 150);

  } else {

    noStroke();

    fill(255);

    ellipse(390, 150, 48, 60);

    fill(0);

    ellipse(398, 150, 32, 44);

  }

  noStroke();

  fill(126, 65, 20);

  ellipse(510, 165, 14, 16);

 

  strokeWeight(3);

  stroke(250, 170, 40);

  noFill();

  bezier(330, 210, 320, 220, 330, 250, 350, 250);

  bezier(340, 205, 330, 215, 340, 245, 360, 245);

  bezier(355, 200, 345, 210, 355, 240, 375, 240);

}

copyright © 2021.  제작된 본 홈페이지에 대한 모든 권리는 <쫑미술>에 귀속됩니다.

New Media Art for Middle School Students

bottom of page