radial wiping rectangle

[p5js code canvas]
int w = 8, h = 8;
int points = 8;
float [] xArray = new float [points];
int constant = 1;
float angle = 4;
float scalar = 124;
float speed = .5;
float colorBG = 150;
float shade;

void setup() {
size(300, 300);
frameRate(60);
background(0,150,0);
}

void draw() {
rotate(scalar/10);
float x2 = constant * sin(angle) + scalar;
float y2 = constant * cos(angle) + scalar;
angle = angle + speed;
speed = 1;
scalar -= 1;
scalar = scalar%300;
if (scalar <= – 300) {
scalar+=1;
}
if (scalar >= 300) {
scalar-=1;
}

for (int i = 0; i < points; i+=4) {
xArray[i] = i-(points/2);
stroke(255);
fill(0,10);
rect(150+width/2+xArray[i]+x2, 150+height/2+y2, w*-scalar/32, h*-scalar/32);
}

if (mousePressed){
fill(0, 10);
rect(0,0,width,height);
}
}

[/p5js]