Promo kit: add 600x300 wide and 250x250 small banners for all 3 angles

Member request: 600x300 and 250x250 sizes. art.mjs gains layouts for both
and an ONLY=<shapes> switch to render just those shapes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-18 09:54:29 -06:00
parent 22dbf4e222
commit c59216ec08
8 changed files with 14 additions and 5 deletions
+2 -1
View File
@@ -11,7 +11,8 @@ const netsites = require('./netsites');
const KIT_DIR = path.join(__dirname, 'public', 'art', 'kit'); const KIT_DIR = path.join(__dirname, 'public', 'art', 'kit');
const SHAPES = { tile: [125, 125, 'Square button'], strip: [468, 60, 'Strip'], leader: [728, 90, 'Leaderboard'], box: [300, 250, 'Box'], panel: [336, 280, 'Large box'], const SHAPES = { tile: [125, 125, 'Square button'], strip: [468, 60, 'Strip'], leader: [728, 90, 'Leaderboard'], box: [300, 250, 'Box'], panel: [336, 280, 'Large box'],
tower: [160, 600, 'Skyscraper'], social: [1200, 630, 'Social share'], square: [1080, 1080, 'Square post'] }; tower: [160, 600, 'Skyscraper'], social: [1200, 630, 'Social share'], square: [1080, 1080, 'Square post'],
wide: [600, 300, 'Wide card'], small: [250, 250, 'Small square'] };
const ANGLES = { plant: 'Bring your program', grow: 'Save your ID, grow the bed', spot: 'Spotlight a packet' }; const ANGLES = { plant: 'Bring your program', grow: 'Save your ID, grow the bed', spot: 'Spotlight a packet' };
function copy() { function copy() {
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

+12 -4
View File
@@ -32,15 +32,20 @@ body{font-family:'Atkinson Hyperlegible',sans-serif;color:#12291F;background:#F6
const page = (w, h, body, cls) => `<!doctype html><html><head>${FONTS}<style>${CSS}</style></head><body class="${cls || ''}" style="width:${w}px;height:${h}px">${body}</body></html>`; const page = (w, h, body, cls) => `<!doctype html><html><head>${FONTS}<style>${CSS}</style></head><body class="${cls || ''}" style="width:${w}px;height:${h}px">${body}</body></html>`;
const ic = (k, s) => `<span class="ic" style="display:inline-block;width:${s}px;height:${s}px">${ICONS[k]}</span>`; const ic = (k, s) => `<span class="ic" style="display:inline-block;width:${s}px;height:${s}px">${ICONS[k]}</span>`;
const ANG = { const ANG = {
plant: { kick: 'Open to every program', h: 'Bring your program. <em>The network grows it.</em>', s: 'Plant it free in the Seed Bed', cta: 'Plant it free', icon: 'iconGardening', cls: 'plate' }, plant: { kick: 'Open to every program', h: 'Bring your program. <em>The network grows it.</em>', s: 'Plant it free in the Seed Bed', t: 'Plant your program <em>free.</em>', cta: 'Plant it free', icon: 'iconGardening', cls: 'plate' },
grow: { kick: 'The Seed Bed', h: 'Save your ID. <em>Your link first.</em>', s: 'Everyone you bring sees your referral link first', cta: 'Save my IDs', icon: 'iconSprout', cls: 'ink' }, grow: { kick: 'The Seed Bed', h: 'Save your ID. <em>Your link first.</em>', s: 'Everyone you bring sees your referral link first', t: 'Save your ID. <em>Your link first.</em>', cta: 'Save my IDs', icon: 'iconSprout', cls: 'ink' },
spot: { kick: 'One-time, paid in POL', h: 'Spotlight <em>a packet.</em>', s: '1,000 guaranteed views at the top of the Seed Bed', cta: 'Spotlight it', icon: 'iconEvolution', cls: 'butter' } spot: { kick: 'One-time, paid in POL', h: 'Spotlight <em>a packet.</em>', s: '1,000 guaranteed views at the top of the Seed Bed', t: 'Spotlight <em>a packet.</em>', cta: 'Spotlight it', icon: 'iconEvolution', cls: 'butter' }
}; };
function creative(a, shape) { function creative(a, shape) {
const [w, h] = SHAPES[shape]; const A = ANG[a]; const k = Math.min(w, h); const [w, h] = SHAPES[shape]; const A = ANG[a]; const k = Math.min(w, h);
const wm = sz => `<div class="wm" style="font-size:${sz}px">${MARK(Math.round(sz * 1.3))}YourProgramBuilder</div>`; const wm = sz => `<div class="wm" style="font-size:${sz}px">${MARK(Math.round(sz * 1.3))}YourProgramBuilder</div>`;
if (shape === 'tile') return page(w, h, `<div style="padding:9px;display:flex;flex-direction:column;justify-content:space-between;height:100%">${MARK(30)}<div class="h" style="font-size:17px">${A.h.replace(/<em>.*<\/em>/, '')}</div><div class="btn" style="font-size:11px;padding:5px 8px;text-align:center">${A.cta}</div></div>`, A.cls === 'plate' ? '' : A.cls); if (shape === 'tile') return page(w, h, `<div style="padding:9px;display:flex;flex-direction:column;justify-content:space-between;height:100%">${MARK(30)}<div class="h" style="font-size:17px">${A.h.replace(/<em>.*<\/em>/, '')}</div><div class="btn" style="font-size:11px;padding:5px 8px;text-align:center">${A.cta}</div></div>`, A.cls === 'plate' ? '' : A.cls);
if (h <= 90) return page(w, h, `<div style="display:flex;align-items:center;gap:14px;height:100%;padding:0 14px">${MARK(h - 26)}<div style="flex:1;min-width:0"><div class="h" style="font-size:${h < 70 ? 19 : 26}px;white-space:nowrap;overflow:hidden">${A.h}</div>${h >= 90 ? `<div style="font-size:14px;opacity:.8">${A.s}</div>` : ''}</div><div class="btn" style="font-size:${h < 70 ? 13 : 16}px;padding:${h < 70 ? '8px 12px' : '11px 18px'}">${A.cta}</div></div>`, A.cls === 'plate' ? '' : A.cls); if (h <= 90) return page(w, h, `<div style="display:flex;align-items:center;gap:14px;height:100%;padding:0 14px">${MARK(h - 26)}<div style="flex:1;min-width:0"><div class="h" style="font-size:${h < 70 ? 19 : 26}px;white-space:nowrap;overflow:hidden">${A.h}</div>${h >= 90 ? `<div style="font-size:14px;opacity:.8">${A.s}</div>` : ''}</div><div class="btn" style="font-size:${h < 70 ? 13 : 16}px;padding:${h < 70 ? '8px 12px' : '11px 18px'}">${A.cta}</div></div>`, A.cls === 'plate' ? '' : A.cls);
if (shape === 'wide') return page(w, h, `<div style="padding:30px 32px;display:flex;flex-direction:column;justify-content:space-between;height:100%;max-width:${A.cls === 'plate' ? 380 : 420}px">
${wm(19)}<div><div class="m" style="font-size:11px;margin-bottom:10px;color:${A.cls === 'ink' ? '#7FD8A0' : '#1B6E3C'}">${A.kick}</div><div class="h" style="font-size:${A.cls === 'plate' ? 36 : 42}px">${A.h}</div>
<div style="font-size:16px;opacity:.85;margin-top:10px">${A.s}</div></div><div><span class="btn" style="font-size:16px;padding:10px 22px">${A.cta}</span></div></div>${A.cls === 'plate' ? '' : `<div style="position:absolute;right:30px;top:50%;transform:translateY(-50%);opacity:.9">${ic(A.icon, 150)}</div>`}`, A.cls);
if (shape === 'small') return page(w, h, `<div style="padding:18px;display:flex;flex-direction:column;justify-content:space-between;height:100%">
${wm(15)}<div class="h" style="font-size:31px">${A.t}</div><div><span class="btn" style="font-size:15px;padding:9px 18px">${A.cta}</span></div></div>`, A.cls === 'plate' ? '' : A.cls);
if (shape === 'tower') return page(w, h, `<div style="padding:18px 14px;display:flex;flex-direction:column;gap:16px;height:100%">${MARK(44)}<div class="m" style="font-size:10px;color:#22844A">${A.kick}</div><div class="h" style="font-size:30px">${A.h}</div>${ic(A.icon, 90)}<div style="font-size:15px">${A.s}</div><div style="margin-top:auto" class="btn" style="font-size:14px;padding:10px 14px;text-align:center">${A.cta}</div></div>`, A.cls === 'plate' ? '' : A.cls); if (shape === 'tower') return page(w, h, `<div style="padding:18px 14px;display:flex;flex-direction:column;gap:16px;height:100%">${MARK(44)}<div class="m" style="font-size:10px;color:#22844A">${A.kick}</div><div class="h" style="font-size:30px">${A.h}</div>${ic(A.icon, 90)}<div style="font-size:15px">${A.s}</div><div style="margin-top:auto" class="btn" style="font-size:14px;padding:10px 14px;text-align:center">${A.cta}</div></div>`, A.cls === 'plate' ? '' : A.cls);
const big = w >= 1000; const fs1 = big ? (shape === 'square' ? 88 : 66) : Math.round(k / 8.5); const big = w >= 1000; const fs1 = big ? (shape === 'square' ? 88 : 66) : Math.round(k / 8.5);
return page(w, h, `<div style="padding:${Math.round(k / 14)}px;display:flex;flex-direction:column;justify-content:center;gap:${Math.round(k / 30)}px;height:100%;max-width:${A.cls === 'plate' ? Math.round(w * .62) : w}px"> return page(w, h, `<div style="padding:${Math.round(k / 14)}px;display:flex;flex-direction:column;justify-content:center;gap:${Math.round(k / 30)}px;height:100%;max-width:${A.cls === 'plate' ? Math.round(w * .62) : w}px">
@@ -50,8 +55,11 @@ function creative(a, shape) {
} }
const b = await chromium.launch(); const ctx = await b.newContext({ deviceScaleFactor: 1 }); const pg = await ctx.newPage(); const b = await chromium.launch(); const ctx = await b.newContext({ deviceScaleFactor: 1 }); const pg = await ctx.newPage();
async function shot(html, w, h, out) { await pg.setViewportSize({ width: w, height: h }); await pg.setContent(html, { waitUntil: 'networkidle' }); await pg.evaluate(() => document.fonts.ready); await pg.screenshot({ path: out, type: 'png' }); } async function shot(html, w, h, out) { await pg.setViewportSize({ width: w, height: h }); await pg.setContent(html, { waitUntil: 'networkidle' }); await pg.evaluate(() => document.fonts.ready); await pg.screenshot({ path: out, type: 'png' }); }
const ONLY = (process.env.ONLY || '').split(',').filter(Boolean);
if (!ONLY.length) {
await shot(page(192, 192, `<div style="display:grid;place-items:center;height:100%;background:#F6FAF1">${MARK(160)}</div>`), 192, 192, path.join(ART, 'icon-192.png')); await shot(page(192, 192, `<div style="display:grid;place-items:center;height:100%;background:#F6FAF1">${MARK(160)}</div>`), 192, 192, path.join(ART, 'icon-192.png'));
await shot(page(1200, 630, `<div style="padding:70px 64px;display:flex;flex-direction:column;justify-content:center;gap:22px;height:100%;max-width:760px"><div class="wm" style="font-size:40px">${MARK(52)}YourProgramBuilder</div><div class="h" style="font-size:72px">Bring your program. <em>The network grows it.</em></div><div style="font-size:28px;color:#35503F">Plant it free in the Seed Bed. Members save their IDs. The ones that grow move into the builder.</div></div>`, 'plate'), 1200, 630, path.join(ART, 'og-share.png')); await shot(page(1200, 630, `<div style="padding:70px 64px;display:flex;flex-direction:column;justify-content:center;gap:22px;height:100%;max-width:760px"><div class="wm" style="font-size:40px">${MARK(52)}YourProgramBuilder</div><div class="h" style="font-size:72px">Bring your program. <em>The network grows it.</em></div><div style="font-size:28px;color:#35503F">Plant it free in the Seed Bed. Members save their IDs. The ones that grow move into the builder.</div></div>`, 'plate'), 1200, 630, path.join(ART, 'og-share.png'));
for (const [n, cls] of [['plate', 'plate'], ['bed', 'ink']]) await shot(page(1200, 630, `<div style="padding:70px 64px;display:flex;flex-direction:column;justify-content:center;gap:20px;height:100%;max-width:${cls === 'plate' ? 760 : 1100}px"><div class="wm" style="font-size:40px">${MARK(52)}YourProgramBuilder</div><div class="m" style="font-size:22px;color:${cls === 'ink' ? '#7FD8A0' : '#1B6E3C'}">A Spotlight was just bought</div><div class="h" style="font-size:76px">Split on chain, <em>in the same transaction.</em></div><div style="font-size:28px;opacity:.85">20% sponsor, 5% each levels 2 to 5. Verify it on Polygonscan.</div></div>`, cls), 1200, 630, path.join(ART, 'proof', 'ypb-proof-' + n + '.png')); for (const [n, cls] of [['plate', 'plate'], ['bed', 'ink']]) await shot(page(1200, 630, `<div style="padding:70px 64px;display:flex;flex-direction:column;justify-content:center;gap:20px;height:100%;max-width:${cls === 'plate' ? 760 : 1100}px"><div class="wm" style="font-size:40px">${MARK(52)}YourProgramBuilder</div><div class="m" style="font-size:22px;color:${cls === 'ink' ? '#7FD8A0' : '#1B6E3C'}">A Spotlight was just bought</div><div class="h" style="font-size:76px">Split on chain, <em>in the same transaction.</em></div><div style="font-size:28px;opacity:.85">20% sponsor, 5% each levels 2 to 5. Verify it on Polygonscan.</div></div>`, cls), 1200, 630, path.join(ART, 'proof', 'ypb-proof-' + n + '.png'));
let n = 0; for (const a of Object.keys(ANG)) for (const s of Object.keys(SHAPES)) { const [w, h] = SHAPES[s]; await shot(creative(a, s), w, h, path.join(ART, 'kit', 'ypb-' + a + '-' + s + '.png')); n++; } }
let n = 0; for (const a of Object.keys(ANG)) for (const s of Object.keys(SHAPES)) { if (ONLY.length && !ONLY.includes(s)) continue; const [w, h] = SHAPES[s]; await shot(creative(a, s), w, h, path.join(ART, 'kit', 'ypb-' + a + '-' + s + '.png')); n++; }
await b.close(); console.log('art written:', n, 'kit creatives + icon, og, 2 proof cards'); await b.close(); console.log('art written:', n, 'kit creatives + icon, og, 2 proof cards');