程序運(yùn)行效果:

Processing代碼:
// gradiant varied by distance to mouse int w = 5; // width of each rectangle int y; void setup(){ size(640, 480); y = height/2; colorMode(RGB, width); rectMode(CENTER); noStroke(); } void draw(){ for(int x = w/2; x<width-w/2; x+=w){ int dx = abs(mouseX-x); // distance to mouse fill(dx); rect(x, y, w, height); } }
浙公網(wǎng)安備 33010602011771號