counter

鈴欄

SUZURAN

情報システム基礎1・6日目


今日もひたすら、"Processingのソースコードを知る。" 作業。

でもって、『私の時計』のプラミングをしました。

基本中の基本のソースコードでも、のちほど写真を載せたいと思っていますが、

もし、Processing環境があって、改良してあげましょうという方は、

下のソースをコピペして、動作を見てアドバイス下さいな。

全然、思い通りに出来ない!!って、やっぱり悔いが残りますわぁ、、


~~~~~~~~~~~~~~~~~~~~~~~~~↓この下から↓~~~~~~~~~~~~~~~~~~~~~~~~~

/**
* < Dot Clock > 2013/6/23
*
*/

boolean flag;
int y;
int n;

void setup() {
size(600,650);
frameRate(2);
flag = false;
n = 1;
background(255);
smooth();

y = 1;
}

void draw() {
fill(255);
rect(365, 605, 170, 20);

fill(178, 167, 184);

textSize(12);
text(year()+"/"+month()+"/"+day()+"=^.^="+hour()+":"+minute()+":"+second(), 367, 620);

noStroke();
smooth();
if(flag == false) {

for(int i = 0; i <= n; i++) {
ellipse(8 * i + 50, 50 + y, 1, 1);
if ((i % 10) == 0) ellipse (8 * i + 50, 50 + y, 3, 3);
}

n++;
if (n > 60) {
n = 1;
y = y + 6;

}
if(y > 360){
background(255);
y=0;
}

}
flag = !flag;

fill(208, 194, 209);
ellipse(450, 500, 160, 160);
float s = map(second(), 0, 60, 0, TWO_PI) - HALF_PI;
float m = map(minute(), 0, 60, 0, TWO_PI) - HALF_PI;
float h = map(hour() % 12, 0, 12, 0, TWO_PI) - HALF_PI;
stroke(255);
strokeWeight(1);
line(450, 500, cos(s) * 72 + 450, sin(s) * 72 + 500);
strokeWeight(2);
line(450, 500, cos(m) * 60 + 450, sin(m) * 60 + 500);
strokeWeight(5);
line(450, 500, cos(h) * 50 + 450, sin(h) * 50 + 500);

fill(255);
textSize(24);
text("12",435,445);

textSize(12);
text("7",410,565);
text("11",408,445);

textSize(18);
text("2",505,470);
text("5",485,565);

textSize(10);
text("1",485,445);
text("10",385,465);

textSize(16);
text("4",508,540);
text("8",385,542);

textSize(34);
text("6",440,575);

textSize(30);
text("9",375,510);

textSize(28);
text("3",510,510);
}


~~~~~~~~~~~~~~~~~~~~~~~~~↑この上まで↑~~~~~~~~~~~~~~~~~~~~~~~~~


ね〜? 頑張って作って、なんとか普通に動作するのは確認できたけれど、

…チンプンカンプンでしょぅ!?