int dot_total = 4000; dot [] dot_array = new dot [dot_total]; color bg_color = 0x000000; BImage bg; int bgW, bgH, bgSx, bgSy; int black_array [][] = new int [400*200][3]; String bg_name [] = {"bg_circle.gif","bg_triangle.gif","bg_rectangle.gif"}; color tcol_array [] = {0x0000FF,0xFFFF00,0xFF0000}; int b = 0; // current numbers of Images void setup(){ size(500,500); background(bg_color); bg_setting(); bg_array_setting(); init_dot(); } void mouseReleased(){ b++; b = b%3; k = 0; bg_setting(); bg_array_setting(); move_dot(); } void bg_setting(){ bg = loadImage(bg_name[b]); bgW = bg.width; bgH = bg.height; bgSx = (width-bgW)/2; bgSy = (height-bgH)/2; } int k = 0; //current numbers of black pixels void bg_array_setting(){ for(int i=0;i.1 || abs(tg-g)>.1 || abs(tb-b)>.1){ r += (tr-r)/damperX; g += (tg-g)/damperX; b += (tb-b)/damperX; col = color(r,g,b); } } void draw_me(){ noStroke(); fill(col); rect(x,y,1,1); } }