initial remote
This commit is contained in:
@@ -80,17 +80,34 @@ export function buildPDF(scene, params, pageSize = 1728) {
|
||||
if (scene.shock) {
|
||||
const sh = scene.shock;
|
||||
const px = tx(sh.x), py = ty(sh.y);
|
||||
c += `q\n${inkCMYK} K\n1 J\n`;
|
||||
for (const st of sh.striations) {
|
||||
const ix = px + Math.cos(st.a) * st.inner * scale, iy = py - Math.sin(st.a) * st.inner * scale;
|
||||
const ox = px + Math.cos(st.a) * st.outer * scale, oy = py - Math.sin(st.a) * st.outer * scale;
|
||||
c += `${gs(st.opacity)}${(st.width * u).toFixed(2)} w\n${ix.toFixed(1)} ${iy.toFixed(1)} m ${ox.toFixed(1)} ${oy.toFixed(1)} l S\n`;
|
||||
if (params.diskBubbles !== false && sh.bubbleStrokes) {
|
||||
// disk line work as bubbles (same method as tracks)
|
||||
const dRng = makeRng(params.seed, 'diskbubbles');
|
||||
const dbk = new Map();
|
||||
for (const stroke of sh.bubbleStrokes) {
|
||||
const key = Math.round(Math.min(1, 0.45 + stroke.weight * 0.5) * 20) / 20;
|
||||
if (!dbk.has(key)) dbk.set(key, []);
|
||||
dbk.get(key).push(...sampleBubbles(stroke, params, dRng));
|
||||
}
|
||||
c += `q\n${inkCMYK} k\n`;
|
||||
for (const [alpha, bubs] of dbk) {
|
||||
c += gs(alpha);
|
||||
for (const b of bubs) c += circlePath(tx(b.x), ty(b.y), Math.max(b.r * scale, 0.5)) + 'f\n';
|
||||
}
|
||||
c += `Q\n`;
|
||||
} else {
|
||||
c += `q\n${inkCMYK} K\n1 J\n`;
|
||||
for (const st of sh.striations) {
|
||||
const ix = px + Math.cos(st.a) * st.inner * scale, iy = py - Math.sin(st.a) * st.inner * scale;
|
||||
const ox = px + Math.cos(st.a) * st.outer * scale, oy = py - Math.sin(st.a) * st.outer * scale;
|
||||
c += `${gs(st.opacity)}${(st.width * u).toFixed(2)} w\n${ix.toFixed(1)} ${iy.toFixed(1)} m ${ox.toFixed(1)} ${oy.toFixed(1)} l S\n`;
|
||||
}
|
||||
for (const k of sh.core) {
|
||||
c += `${gs(k.opacity)}${(k.width * u).toFixed(2)} w\n${tx(k.x1).toFixed(1)} ${ty(k.y1).toFixed(1)} m ${tx(k.x2).toFixed(1)} ${ty(k.y2).toFixed(1)} l S\n`;
|
||||
}
|
||||
for (const ring of sh.rings) c += `${gs(ring.opacity)}${(ring.width * u).toFixed(2)} w\n` + strokeCircle(px, py, ring.rr * scale);
|
||||
c += `Q\n`;
|
||||
}
|
||||
for (const k of sh.core) {
|
||||
c += `${gs(k.opacity)}${(k.width * u).toFixed(2)} w\n${tx(k.x1).toFixed(1)} ${ty(k.y1).toFixed(1)} m ${tx(k.x2).toFixed(1)} ${ty(k.y2).toFixed(1)} l S\n`;
|
||||
}
|
||||
for (const ring of sh.rings) c += `${gs(ring.opacity)}${(ring.width * u).toFixed(2)} w\n` + strokeCircle(px, py, ring.rr * scale);
|
||||
c += `Q\n`;
|
||||
}
|
||||
|
||||
// bubbles (bucketed by alpha)
|
||||
|
||||
Reference in New Issue
Block a user