{
let width = 640,
height = 640,
count = 200,
radius = 100,
noise = cm.randomNoise(),
string = text,
chars = null,
font = { fontSize: 100 };
function step(app) {
let prev = 0;
chars = string.split("").map((d) => {
const { width } = app.textBBox({ text: d, ...font });
const step = width / (radius * 1.8);
const theta = prev + step / 2;
prev += step;
return { t: theta, c: d };
});
}
function update(app) {
const time = app.prop("frameCount") / 100;
const x = width / 2;
const y = height / 3;
app.append(cm.clear, { fill: "black" });
app
.call(drawHeart, { x, y, count, radius, noise, time })
.call(drawEyes, { x, y, r: radius / 2, radius })
.call(drawTexts, { x, y, chars, radius, noise, time, ...font });
}
function dispose(app) {
invalidation.then(() => app.dispose());
}
return cm
.app({ width, height })
.on("beforeAll", step)
.on("update", update)
.call(dispose)
.start()
.node();
}