Sine Surface Movement
/** * Sine Surface Movement * * @author aa_debdeb * @date 2015/09/03 */ float BLOCK_SIZE = 5; int BLOCK_NUM = 100; float radian = 0.0; float radianStep = PI / 100; void setup(){ size(501, 501); smooth(); frameRate(30); } void draw(){ stroke(128); strokeWeight(1.0); for(int w = 0; w < BLOCK_NUM; w++){ fill(255.0 * sin(radian + ((float)w / BLOCK_NUM) * PI)); for(int h = 0; h < BLOCK_NUM; h++){ rect(w * BLOCK_SIZE, h * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE); } } radian += radianStep; if(radian >= 2.0 * PI){ radian -= 2.0 * PI; } }