{
replay;
const width = 600,
height = 200,
movers = cm.range(20).map(() => ({
location: cm.vec(cm.random(width), cm.random(height)),
velocity: cm.vec(),
acceleration: cm.vec(),
speed: 8
}));
function update(app) {
app.append(cm.clear, { fill: cm.rgb(255) });
app
.data(movers)
.process(cm.each, follow)
.append(cm.circle, {
x: (d) => d.location.x,
y: (d) => d.location.y,
fill: "rgba(175, 175, 175, 0.5)",
stroke: cm.rgb(0),
r: 16
});
}
function dispose(app) {
invalidation.then(() => app.dispose());
}
function border(app) {
app.node().style.border = "solid #000 1px";
}
return cm
.app({ width, height })
.on("update", update)
.call(dispose)
.call(border)
.start()
.node();
}