xxxxxxxxxx
44
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.3.1/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.3.1/addons/p5.sound.min.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="style.css"> -->
<meta charset="utf-8" />
<style>
html, body {
margin: 0;
padding: 0;
}
canvas {
display: block;
}
</style>
</head>
<body>
<script>
let x = 1;
let y = 1;
let easing = 0.05;
function setup() {
createCanvas(720, 400);
noStroke();
}
function draw() {
background(0);
let targetX = mouseX;
let dx = targetX - x;
x += dx * easing;
let targetY = mouseY;
let dy = targetY - y;
y += dy * easing;
ellipse(x, y, 66, 66);
}
</script>
</body>
</html>