top of page

랜덤한 위치에 그려지는 원들을 선으로 연결

int x1, y1, x2, y2;

int count=0;

 

void setup(){

  size(720, 480);

  background(10, 10, 50);

  frameRate(10);

  x2=0;

  y2=0;

}

 

void draw(){

  noStroke();

  fill(10, 10, 50,5);

  rect(0, 0, width, height);

  x1 = int(random(width));

  y1 = int(random(height));

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

  ellipse(x1, y1, 10, 10);

  stroke(255);

  line(x1, y1, x2, y2);

  x2 = x1;

  y2 = y1;

  println(x1+":"+y1);

}

 

void keyPressed(){

  if (key== 's') {

  saveFrame("image"+nf(count, 3)+".jpg");

  count+=1;

  }

}

랜덤한 위치에 출력되는 단어들을 선으로 연결

String[] myText={"Janwon", "Middle-school", "Seoul", "Jung-gu", "Dongho"};

PFont font;

int x1, y1, x2, y2;

int count=0;

 

void setup(){

  size(720, 480);

  background(10, 10, 50);

  frameRate(10);

  printArray(PFont.list());

  font=createFont("TaiHeritagePro-Bold", 50);

  textFont(font);

  x2=0;

  y2=0;

}

 

void draw(){

  noStroke();

  fill(10, 10, 50, 5);

  rect(0, 0, width, height);

  int index = int(random(5));

  x1 = int(random(width));

  y1 = int(random(height));

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

  textSize(random(10, 50));

  textAlign(CENTER, CENTER);

  text(myText[index], x1, y1);

  stroke(255);

  line(x1, y1, x2, y2);

  x2 = x1;

  y2 = y1;

  println(myText[index]);

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

}

 

void keyPressed(){

  if (key== 's') {

  saveFrame("image"+nf(count, 3)+".jpg");

  count+=1;

  }

}

마우스 클릭한 위치에 텍스트 출력하기

String[] myText={

  "Janwon", "Middle-school", "Seoul", "Jung-gu", "Dongho"

};

PFont font;

int count=0;

 

void setup(){

  size(720, 480);

  background(10, 10, 50);

  frameRate(5);

  printArray(PFont.list());

  font=createFont("TaiHeritagePro-Bold", 50);

  textFont(font);

}

 

void draw(){

  noStroke();

  fill(10, 10, 50, 5);

  rect(0, 0, width, height);

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

}

 

void mousePressed(){

  int index = int(random(5));

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

  textSize(random(10, 50));

  textAlign(CENTER, CENTER);

  text(myText[index], mouseX, mouseY);

  println(myText[index]);

}

 

void keyPressed(){

  if (key=='s') {

    saveFrame("image"+nf(count, 3)+ ".jpg");

    count+=1;

  }

}

마우스 클릭한 위치에 텍스트 한 행을 출력하기

String myText=

  "Janwon\nMiddle-school\nSeoul\nJung-gu\nDongho";

  

PFont font;

int x = 360;

int y = 240;

int count=0;

 

void setup(){

  size(720, 480);

  printArray(PFont.list());

  font=createFont("TaiHeritagePro-Bold", 25);

  textFont(font);

}

 

void draw(){

  background(10, 10, 50);

  if (key == CODED) {

  if (keyCode == UP) {

  y--;

  if (y<-150) {

    y=height+150;

  }

  } else if (keyCode == DOWN) {

    y++;

    if (y>height+150) {

      y=-150;

  } else if (keyCode == LEFT) {

    x--;

    if (x<-240) {

      x=width+240;

    }

  } else if (keyCode == RIGHT) {

    x++;

    if (x>width+240) {

      x=-240;

    }

  } else {

    x=x;

    y=y;

  }

  }

  fill(255);

  textSize(25);

  textAlign(CENTER, CENTER);

  text(myText, x, y);

  }

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

}

 

void keyPressed(){

  if (key=='s') {

    saveFrame("image"+nf(count, 3)+".jpg");

    count+=1;

  }

}

지정축을 기준으로 텍스트 3D 회전시키기 

String myText=

  "Janwon\nMiddle-school\nSeoul\nJung-gu\nDongho";

  

PFont font;

float angle=0.0;

int count=0;

 

void setup(){

  size(720, 480, P3D);

  printArray(PFont.list());

  font=createFont("TaiHeritagePro-Bold", 25);

  textFont(font);

}

 

void draw(){

  background(10, 10, 50);

  fill(255);

  textSize(25);

  translate(width/2, height/2);

  rotateX(angle);

  textAlign(CENTER, CENTER);

  text(myText, 0, 0);

  angle+=0.01;

  println(angle);

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

}

 

void keyPressed(){

  if (key=='s') {

    saveFrame("image"+nf(count, 3)+".jpg");

    count+=1;

  }

}

마우스 위치에 따라 텍스트 회전 변경하기

String myText=

  "Janwon\nMiddle-school\nSeoul\nJung-gu\nDongho";

  

PFont font;

float angle=0.0;

int count=0;

 

void setup(){

  size(720, 480, P3D);

  printArray(PFont.list());

  font=createFont("TaiHeritagePro-Bold", 25);

  textFont(font);

}

 

void draw(){

  background(#CAFF46);

  fill(255);

  textSize(25);

  translate(width/2, height/2);

  rotateX(angle);

  textAlign(CENTER, CENTER);

  text(myText, 0, 0);

  angle=map(mouseX, 0, width, 0, TWO_PI);

  println(angle);

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

}

 

void keyPressed(){

  if (key=='s') {

    saveFrame("image"+nf(count, 3)+".jpg");

    count+=1;

  }

}

​별이 빛나는 밤 작품 픽셀 변형시키기

PImage img;

int pSize=5;

int count=0;

 

void setup(){

  size(800, 600);

  background(0);

  img = loadImage("gogh.jpg");

}

 

void draw(){

  for (int y=0; y<height; y+=pSize){

  for (int x=0; x<width; x+=pSize){

  color c = img.get(x, y);

  fill(c);

  stroke(0);

  rect(x, y, pSize, pSize);

}

}

println(pSize);

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

}

 

void keyPressed(){

  if (key=='i'){

  background(0);

pSize+=1;

}

if (key=='d'){

background(0);

pSize-=1;

if (pSize<=0) {

pSize=1;

}

}

if (key=='s') {

saveFrame("image"+nf(count, 3)+".jpg");

count+=1;

}

}

gogh.jpg

​이미지 픽셀화 하기

PImage img;

int pSize=5;

int count=0;

 

void setup(){

  size(1300, 700);

  background(0);

  img = loadImage("img00.png");

}

 

void draw(){

  for (int y=0; y<height; y+=pSize){

  for (int x=0; x<width; x+=pSize){

  color c = img.get(x, y);

  fill(c);

  stroke(0);

  rect(x, y, pSize, pSize);

}

}

println(pSize);

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

}

 

void keyPressed(){

  if (key=='i'){

  background(0);

pSize+=1;

}

if (key=='d'){

background(0);

pSize-=1;

if (pSize<=0) {

pSize=1;

}

}

if (key=='s') {

saveFrame("image"+nf(count, 3)+".jpg");

count+=1;

}

}

img00.png

이미지 타원 모양으로 픽셀화 하기

selfpotrait.jpg

PImage img;

int pSize=5;

int count=0;

 

void setup(){

  size(600, 700);

  background(0);

  img = loadImage("selfpotrait.jpg");

}

 

void draw (){

  for (int y=0; y<height; y+=pSize) {

  for (int x=0; x<width; x+=pSize) {

  color c = img.get(x,y);

  fill(c);

  stroke(0);

  ellipseMode(CORNER);

  ellipse(x, y, pSize, pSize);

}

}

println(pSize);

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

}

 

void keyPressed (){

  if (key=='i') {

  background(0);

  pSize+=1;

}

if (key=='d') {

  background(0);

  pSize-=1;

  if (pSize<=0) {

  pSize=1; 

}

}

if (key=='s') {

  saveFrame("image"+nf(count, 3)+".jpg");

  count+=1;

}

}

이미지 점묘법으로 스케치하기

PImage img;

int x, y;

int pSize=1;

int count=0;

 

void setup(){

  size(520, 480);

  background(255);

  img = loadImage("songmin.jpg");

}

 

void draw() {

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

  x=int(random(width));

  y=int(random(height));

  color c = img.get(x, y);

  fill(c);

  pSize=int(random(map(mouseX, 0, width, 1, 50)));

  noStroke();

  ellipse(x, y, pSize, pSize);

  }

  println(pSize);

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

}

 

void keyPressed (){

  if (key=='r') {

  background(255); 

}

  if (key=='s') {

  saveFrame("image"+nf(count, 3)+".jpg");

count+=1;

}

}

songmin.jpg

스케치창에 마우스로 이미지 추가하기

PImage img, bg;

float[] imgX = new float[1];

float[] imgY = new float[1];

int count=0;

 

void setup(){

size(720, 480);

noStroke();

imgX[0] = width/2;

imgY[0] = height/2;

img=loadImage("balloon.png");

bg=loadImage("bg.jpg");

}

 

void draw(){

background(bg);

for (int i = 0; i < imgX.length; i++) {

imgX[i] += random(-0.03, 0.03);

imgY[i] += random(-1.5, -0.5);

imageMode(CENTER);

image(img, imgX[i], imgY[i], 100, 100);

if (imgY[i] < -30) {

  imgY[i] = -100;

}

}

fill(0, 200);

textSize(15);

textAlign(RIGHT);

text(imgX.length, 60, 20);

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

}

 

void mousePressed(){

imgX = (float[])append(imgX, mouseX);

imgY = (float[])append(imgY, mouseY);

}

 

void keyPressed(){

if (key=='s') {

saveFrame("image"+nf(count, 3)+".jpg");

count+=1;

}

}

bg.jpg
balloon.png

스케치창에 마우스로 이미지 추가하기

PImage img, bg;

float[] imgX = new float[1];

float[] imgY = new float[1];

int count=0;

 

void setup(){

size(720, 539);

noStroke();

imgX[0] = width/2;

imgY[0] = height/2;

img=loadImage("img.png");

bg=loadImage("bg.jpg");

}

 

void draw(){

background(bg);

for (int i = 0; i < imgX.length; i++) {

imgX[i] += random(-0.03, 0.03);

imgY[i] += random(-1.5, -0.5);

imageMode(CENTER);

image(img, imgX[i], imgY[i], 100, 100);

if (imgY[i] < -30) {

  imgY[i] = -100;

}

}

fill(0, 200);

textSize(15);

textAlign(RIGHT);

text(imgX.length, 60, 20);

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

}

 

void mousePressed(){

imgX = (float[])append(imgX, mouseX);

imgY = (float[])append(imgY, mouseY);

}

 

void keyPressed(){

if (key=='s') {

saveFrame("image"+nf(count, 3)+".jpg");

count+=1;

}

}

bg.jpg
img.png

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

New Media Art for Middle School Students

bottom of page