/*** ダイナミックデザイン 第8回課題 Compiler: Processing 0097Beta Date: 2005/12/5 Author: Sho Hashimoto WebSite: http://web.sfc.keio.ac.jp/~t03792sh/ ***/ void setup(){ size(400,300); ellipseMode(CENTER); fill(200); // 塗りつぶし色 stroke(0); // ペン色 rect(0,0,width,height); // 白背景 } int x, y, w, h; int n; int colorR, colorG, colorB, lineColor; void draw(){ if(mousePressed){ // マウス押した時 if(colorR < 255){ colorR+=3; // 赤増加 } else{ // 赤増えきってたら if(colorG < 255) colorG+=3; // 緑増える else{ if(colorB < 255) colorB+=3; // 青増える else{ // 0xFFFFFFだったら colorR = 0; // 初期化 colorG = 0; colorB = 0; } } } strokeWeight(1); // 線の太さ stroke(color(colorR,colorG,colorB)); // RGB line(mouseX,mouseY,mouseX-(mouseX-pmouseX)*10,mouseY-(mouseY-pmouseY)*10); // line(mouseX+20,mouseY-20,mouseX-20,mouseY+20); } if(random(0,20) < 1){ strokeWeight(0); noFill(); // 塗りつぶし無し x = int(random(0,width)); y = int(random(0,height)); w = int(random(0,width)); h = int(random(0,height)); stroke(255); // 線黒 arc(x,y,w,h,0,2*PI); // 円 } delay(3); // ちょっと待つ }