Here Is my code so far. What I'm trying to do is repel the dots away from the mouse but when the mouse leaves the boundaries of the window I'd like the dots to settle back to their grid position. Can this be done with an if else statement maybe?
import hype.*;
import hype.extended.layout.HGridLayout;
import hype.extended.behavior.HAttractor;
HDrawablePool pool;
HAttractor ha;
HAttractor.HAttractionForce hf;
void setup() {
size(1364,640);
H.init(this).background(#242424);
ha = new HAttractor()
.repelMode()
.addForce(320, 320, 200)
.debugMode(false);
hf = ha.getForce(0);
pool = new HDrawablePool(1248);
pool.autoAddToStage()
.add(new HRect(5).rounding(100))
.layout(new HGridLayout().startX(21).startY(21).spacing(26,26).cols(52))
.onCreate(
new HCallback() {
public void run(Object obj) {
HDrawable d = (HDrawable) obj;
d.noStroke().fill(#000000).anchorAt(H.CENTER);
ha.addTarget(d, 8, 1f);
}
}
)
.requestAll()
;
}
void draw() {
hf.loc(mouseX, mouseY);
H.drawStage();
}