xxxxxxxxxx
/*
Move at an angle determined by noise
*/
float noiseScale = 0.02;
float noisePosition = 0;
float x, y;
float moveSpeed = 4;
void setup() {
size( 800, 800);
x = width/2;
y = height/2;
noStroke();
}
void draw() {
//background(0);
float angle = radians( noise(noisePosition) * 360);
noisePosition += noiseScale;
x = x + cos(angle) * moveSpeed;
y = y + sin(angle) * moveSpeed;
ellipse(x, y, 5, 5);
// constrain the movement to the screen
if (x > width) {
x = 0;
} else if (x < 0) {
x = width;
}
if (y > height) {
y = 0;
} else if (y < 0) {
y = height;
}
}