음성고등학교 로고이미지

RSS 페이스북 공유하기 트위터 공유하기 카카오톡 공유하기 카카오스토리 공유하기 네이버밴드 공유하기 프린트하기
processing design
작성자 김용남 등록일 19.09.24 조회수 95

import processing.pdf.*; // Import PDF code

 

int z=25;

int z1=1;

 

float angle=0.0;

 

 

float Speed[]= {0.001, 0.8,0.5}; // input speed & circle speed

float speed= Speed[0]; // input speed

float radius[] = {0, HALF_PI, PI, TWO_PI};

 

 

// move adjust  

 

float CX_start []= {400, 700, 820}; // red circle / whtit circle/ black circle

float CY_start []= {450, 450, 455}; // red circle / whtit circle/ black circle

float CXmove_range []= {200, 420, 300}; // red circle / whtit circle/ black circle

float CYmove_range []= {320, 300, 400}; // red circle / whtit circle/ black circle

 

float TX_start []= {100,300,200};

float TY_start []= {200,140,300};

float TXmove_range []= {100,12,30};

float TYmove_range []= {90,43,30};

 

 

//HSB Color mode adjust

 

int [] H= {200, 200}; // setup color & draw color

int [] S= {100, 150}; //  setup color & draw color

int [] B= {100, 100}; //  setup color & draw color

int [] O= {10, 17}; //  setup color & draw color

 

float colors=radius[2]*0.3;

float colorRange = sin(colors)*25;

float random_color = random(0, colorRange);

 

 

 

void setup()

{

  colorMode(HSB, H[0], S[0], B[0], O[0]); 

  size(1300, 918);

  background(HSB, 0, 0, random_color );

  smooth();

}

 

 

 

void draw() {

 

  colorMode(HSB, H[1], S[1], B[1], O[1]); 

  float random_color = random(0, colorRange);

 

  //red circle

  float X=CX_start[0]+cos(angle+radius[3]/0.7)* CXmove_range[0]; // start & radius x

  float Y=CY_start[0]+sin(angle+radius[2])*CYmove_range[0]; // start & radius y

 

 

  // white circle

  float X1=CX_start[1]+sin(angle+radius[2]/3)*CXmove_range[1]; // start & radius x

  float Y1=CY_start[1]+cos(angle+radius[2]*1.1)*CYmove_range[0]; // start & radius y

 

  // black circle

  float X2=CX_start[2]+sin(angle+radius[2])*CXmove_range[2]; // start & radius x

  float Y2=CY_start[2]+sin(angle+radius[3])*CYmove_range[1]; // start & radius y

 

 

// triangle

 float TX=TX_start[0]+sin(angle)*TXmove_range[0]; // start & radius x

 float TY=TY_start[0]+cos(angle)*TYmove_range[0]; // start & radius y

 

 float TX1=TX_start[1]+ cos(angle+radius[2])*TXmove_range[1]; // start & radius x

 float TY1=TY_start[1]+ cos(angle+radius[1])*TYmove_range[1]; // start & radius y

 

 float TX2=TX_start[2]+ cos(angle*3.0)*TXmove_range[2]; // start & radius x

 float TY2=TY_start[2]+ cos(angle*3.0)*TYmove_range[2]; // start & radius y

  

 

  pushMatrix();  

  translate(400, 400);

  scale(0.5);

 

 

  for (float i=0; i<10; i++) {  

    noStroke();

    

  z=z+z1;

 

if(z>42){

  z1 *=-1;

}

 

else{

z1 *= -1;

}

    fill(random(200), 140, z-3, 0.5);

    tri(random(X), random(Y), noise(X1*32), noise(Y1*4), random(X2), random(Y2), 0.9, 1.2);

 

    pushMatrix();  

    noStroke();

    fill(0, 0, 255, 100);

    circle(random(X), random(Y1), random(3));

    popMatrix();

 

}

  //background color change & dot pattern

 

  popMatrix();

 

 

 

  pushMatrix();  

 

  fill(random_color-9, 180, 90);

  circle(X, Y, 200);

  // circle + line1

 

  strokeWeight(0.5);

  stroke(30, 200, 200);

  line(X, Y, X1, Y1); 

 

  fill(random_color, random_color, 255);

  circle(X1, Y1, 120);

  // circle + line2

 

  strokeWeight(0.5);

  stroke(90, 170, 205);

  line(X1, Y1, X2, Y2); 

 

  fill(30, 10, random_color);

  circle(X2, Y2, 100);

  // circle + line3

 

  fill(0, 0, 255);

  white_circle(X, Y);

  white_circle(X1, Y1);

  white_circle(X2, Y2);

  //circle dot

 

 

pushMatrix();

  strokeWeight(0.5);

  stroke(0, 0, 255);

 

  popMatrix();

 

  noFill();

  stroke(0, 0, 255);

  circle(mouseX, mouseY, 300);

 

  strokeWeight(0.5);

  stroke(0, 0, 255);

  noFill();

 

  line(X2, Y2, mouseX, mouseY);

  //mouse event

  

popMatrix();  

 

 

pushMatrix();

noStroke();

 

fill(random_color+88, 170, 80,20);

 

translate(width/2, height/2); 

scale(0.1) ;

rotate(angle/1.3);

tri1(TX*24,TY*12,TX1*3,TY*3,TX*4,TX*5,TX1*5,TY,2);

 

popMatrix();

 

}

 

 

 

void circle(float circleX, float circleY, float circle_inc) {

  float diameter1 = 0 + (sin(angle + 0) * circle_inc);

  ellipse(circleX, circleY, diameter1, diameter1);

  angle += speed*Speed[1];

}

 

 

void white_circle(float WX, float WY) {

  ellipse(WX, WY, 5, 5);

}

 

 

void tri(float a, float b, float c, float d, float e, float f, float r, float ss) {

  rotate(r);

  scale(ss);

 

  beginShape();

  vertex(a, b);

  vertex(c, d); 

  vertex(e, f);

  endShape();

 

  r +=radius[2]*2;

 

}

 

 

void tri1(float tx, float ty, float tx1, float tx2, float tx3, float ty1, float ty2, float ty3,float tri_inc){

  float diameter2 =  (cos(angle + 0) * tri_inc);

  

translate(tx, ty);

triangle(tx1,tx2,tx3,ty1,ty2,ty3);

 

};

 

 

 

void keyPressed() {

  if (key == 'B' || key == 'b') { // When 'B' or 'b' is pressed,

    beginRecord(PDF, "poster1-###.pdf"); // start recording to the PDF

      background(0,0,0); // Set a white background

  } 

  else if (key == 'E' || key == 'e') { // When 'E' or 'e' is pressed,

    endRecord(); // stop recording the PDF and

    exit(); // quit the program

  }

}

 

이전글 processing Mondrian
다음글 processing fish scales