Example 1: Seek Mouse
Code
let pos, vel;
function setup() {
createCanvas(400, 400);
pos = createVector(width / 2, height / 2);
vel = createVector(0, 0);
}
function draw() {
background(250);
const target = createVector(mouseX, mouseY);
const desired = p5.Vector.sub(target, pos).setMag(3);
const steer = p5.Vector.sub(desired, vel).limit(0.15);
vel.add(steer).limit(4);
pos.add(vel);
fill(255, 45, 140);
noStroke();
circle(pos.x, pos.y, 26);
}Try this: Lower maxForce to make turns smoother and wider.