{
replay;
const w = 600,
h = 200,
engine = matter.Engine.create(),
boxes = [],
boundaries = [
createBoundary(engine.world, w / 4, h - 5, w / 2 - 50, 10),
createBoundary(engine.world, (3 * w) / 4, h - 50, w / 2 - 50, 10)
];
function update(app) {
if (cm.random(1) < 0.1) boxes.push(createBox(engine.world, w / 2, 50));
app.append(cm.clear, { fill: "#fff" });
app.data(boxes).process(cm.eachRight, checkBox).call(appendMatterRect);
app.data(boundaries).call(appendMatterRect);
matter.Engine.update(engine);
}
function dispose(app) {
invalidation.then(() => app.dispose());
}
return cm
.app({ width: w, height: h })
.on("update", update)
.call(dispose)
.start()
.node();
}