double dist, dire; double curH, curS, curB; int xx, yy; double p[] = new double[601]; double ph[] = new double[p.length]; double ps[] = new double[p.length]; double pb[] = new double[p.length]; double hh[] = new double[p.length]; double hs[] = new double[p.length]; double hb[] = new double[p.length]; int cur; boolean mouseP; Polygon pl; Color col; double drawH; boolean done; [setup, 600, 600]{ xx = 0; yy = 0; for(int i = 0; i < p.length; i ++){ ph[i] = 0.; ps[i] = 0.; pb[i] = 0.; p[i] = 0.; hh[i] = 0.; hs[i] = 0.; hb[i] = 0.; } curH = 1.15; curS = 0.99; curB = 0.99; cur = 0; setBackColor(0, 0, 0); done = false; } [paint]{ clearAll(); for(int i = 0; i < cur; i ++){ drawH = ph[i]; if(1.0 < drawH) drawH -=1.0; col = Color.getHSBColor((float)drawH, (float)ps[i], (float)pb[i]); setColor(col); drawLine(p[i], 0, p[i], monitorHeight); } } [interval, 0.02]{ curH -= 0.001; if(cur < p.length-1){ p[cur] = xx; ph[cur] = curH; ps[cur] = curS; pb[cur] = curB; hh[cur] = curH; hs[cur] = curS; hb[cur] = curB; cur += 1; xx += 1.; }else{ done = true; } } [always]{ if(curH < 0.) curH = 0.0; if(curS < 0.) curS = 0.0; if(curB < 0.) curB = 0.0; if(2.0 < curH) curH = 2.0; if(0.99 < curS) curS = 0.99; if(0.99 < curB) curB = 0.99; if(done == true){ for(int i = 0; i < p.length; i ++){ if(mouseP == true){ ph[i] = ph[i] + (hh[i] - ph[i])/3.; ps[i] = ps[i] + (hs[i] - ps[i])/3.; pb[i] = pb[i] + (hb[i] - pb[i])/3.; }else{ dist = mouse.distanceTo(p[i], mouseY); if(dist < 100) pb[i] -= (300 - dist) / 30000.; } if(pb[i] < 0.0) pb[i] = 0.0; } } } [mousepressed]{ mouseP = true; } [mouseReleased]{ mouseP = false; }