xxxxxxxxxx
68
var radius = 10;
var x, y;
var prevX, prevY;
var fade = true;
function setup(){
//fullScreen();
createCanvas(300, 900);
background( 0 );
stroke( 255 );
x = width/2;
y = height/2;
prevX = x;
prevY = y;
stroke(255);
strokeWeight( 2 );
point( x, y );
frameRate(10);
}
function draw(){
var rnd = random (40, 40);
if (!fade) {
noStroke();
fill( 0, 4 );
rect( 0, 0, width, height );
}
var angle = (TWO_PI / 10) * floor( random( 10 ));
x += cos( angle ) * rnd;
y += sin( angle ) * rnd;
if ( x < 0 || x > width ) {
x = prevX;
y = prevY;
}
if ( y < 0 || y > height) {
x = prevX;
y = prevY;
}
noFill();
stroke( 255, 64 );
strokeWeight( 1 );
rect( x, y, prevX/4, prevY/8 );
strokeWeight( 3 );
point( x, y );
prevX = x;
prevY = y;
}
function keyPressed(){
if (key == 'f') {
fade = !fade;
}
if (key == 't') {
noLoop();
}
}