Processing With Android Example


float x;
float y;
float prevX;
float prevY;
float d;
float h;
void setup()
{
size( displayWidth, displayHeight );
background( 0 );
x = random( width );
y = random( height );
prevX = x;
prevY = y;
stroke( 255, 128 );
colorMode( HSB, 360, 20, 100, 1 );
}
void draw()
{
x += random( -30, 30 );
y += random( -30, 30 );
x = constrain( x, 0, width );
y = constrain( y, 0, height );
d = dist( x, y, prevX, prevY );
h = map( d, 0, 42, 0, 360 );
fill( h, 100, 100, 50 );
ellipse( x, y, d, d );
prevX = x;
prevY = y;
}