xxxxxxxxxx
35
/*
* Little dot lerps towards the mouse
*/
// dot position
var x;
var y;
// higher values mean more responsiveness
// lower values mean smoother motion
var lerpAmount = 0.005;
function setup() {
createCanvas(400, 400);
colorMode(HSB, 360, 100, 100);
background(0,0,0);
noStroke();
x = width/2;
y = height/2;
}
function draw() {
background(0, 0, 0, 0.05);
strokeWeight(10);
// lerp x and y towards the mouse to create smooth motion
x = lerp(x, mouseX, lerpAmount);
y = lerp(y, mouseY, lerpAmount);
fill(270, 50, 100);
ellipse(x, y, 30, 30);
}