Reward / Power-up icon as a top-left sticker on the cassette and the video box
Twitch icons of channel point rewards (custom images) and Custom Power-ups are cached (10 min, refreshed on unknown triggers, never holding an alert more than 2 s) and attached as alert.icon; cassette.js and video.js show it as a white-outlined sticker on the top-left corner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b3caac7a31
commit
8ac8fe024c
6 changed files with 63 additions and 7 deletions
|
|
@ -38,3 +38,8 @@
|
|||
background:rgba(201,182,228,.85); background-image:repeating-linear-gradient(45deg,#fff6 0 7px,#0000 7px 14px); }
|
||||
#cassette-alert .strip:before { left:-22px; transform:rotate(-28deg); }
|
||||
#cassette-alert .strip:after { right:-22px; transform:rotate(24deg); }
|
||||
|
||||
/* the reward's / Power-up's Twitch icon as a small sticker on the top-left corner (only when Twitch has one) */
|
||||
#cassette-alert .ico { position:absolute; left:-30px; top:-28px; width:76px; height:76px; display:flex; align-items:center; justify-content:center; z-index:2; }
|
||||
#cassette-alert .ico img { max-width:76px; max-height:76px;
|
||||
filter:drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff) drop-shadow(0 5px 8px rgba(0,0,0,.35)); }
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@
|
|||
<div class="title">${esc(d.title)}</div>
|
||||
<div class="sub">${d.sub && d.sub !== d.title ? esc(d.sub) : ''}</div>
|
||||
<div class="stk"><img src="${esc(d.sticker || DEFAULT_STICKER)}" alt=""></div>
|
||||
${d.icon ? `<div class="ico"><img src="${esc(d.icon)}" alt=""></div>` : ''}
|
||||
${ultra ? '<div class="foil"></div>' + '<div class="spark"></div>'.repeat(6) : ''}
|
||||
</div>
|
||||
<div class="strip"><span class="u">${esc(d.name)}</span> ${esc(d.line)}${d.msg ? `<span class="msg">“${esc(d.msg)}”</span>` : ''}</div>`;
|
||||
|
|
@ -74,6 +75,11 @@
|
|||
{ transform:`translateX(-4px) rotate(${tilt - .6}deg)`, offset:.88 },
|
||||
{ transform:`translateX(0) rotate(${tilt}deg)`, opacity:1 },
|
||||
], { duration:700, easing:'cubic-bezier(.2,.8,.3,1)' });
|
||||
if (q('.ico')) A(q('.ico'), [ // the reward's / Power-up's Twitch icon, top-left corner
|
||||
{ transform:'rotate(10deg) scale(0)', opacity:0 },
|
||||
{ transform:'rotate(-18deg) scale(1.2)', opacity:1, offset:.6 },
|
||||
{ transform:'rotate(-10deg) scale(1)', opacity:1 },
|
||||
], { delay:560, duration:360, easing:'ease-out' });
|
||||
A(q('.stk'), [
|
||||
{ transform:'rotate(-30deg) scale(0)', opacity:0 },
|
||||
{ transform:'rotate(8deg) scale(1.2)', opacity:1, offset:.6 },
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@
|
|||
case 'redeem': {
|
||||
// shown as a cassette tape (cassette.js); polaroid:false = sound only
|
||||
const fill = t => String(t || '').replace(/\{reward\}/g, e.reward || '').replace(/\{variation\}/g, e.variation || '');
|
||||
return { cassette: true, style: e.style || 'cassette', emote: e.emote || null, sticker: rebase(e.art) || null,
|
||||
return { cassette: true, style: e.style || 'cassette', emote: e.emote || null, sticker: rebase(e.art) || null, icon: e.icon || null,
|
||||
name: e.user || 'Someone', line: fill(e.caption || 'redeemed it! ♡'), msg: e.input,
|
||||
title: e.variation || e.reward, sub: e.reward, rarity: e.rarity,
|
||||
sound: e.sound || null, volume: e.volume, soundOnly: e.polaroid === false && !e.tts,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
radial-gradient(ellipse at 50% 45%, #43361a 0%, var(--screen) 70%) #241e12;
|
||||
font-family:'VT323', monospace; color:#fff; text-align:center;
|
||||
}
|
||||
#vfx-box .rec { position:absolute; left:24px; top:16px; font-size:26px; color:#ff3b4e; text-shadow:0 0 6px rgba(255,59,78,.7);
|
||||
#vfx-box .rec { position:absolute; left:58px; top:16px; font-size:26px; color:#ff3b4e; text-shadow:0 0 6px rgba(255,59,78,.7);
|
||||
animation:vfx-blink 1s steps(1) infinite; }
|
||||
#vfx-box .tc { position:absolute; right:24px; top:16px; font-size:24px; opacity:.85; }
|
||||
#vfx-box .title { font-size:36px; line-height:1; text-transform:uppercase; overflow-wrap:anywhere;
|
||||
|
|
@ -33,3 +33,8 @@
|
|||
#vfx-box .brand { position:absolute; right:46px; bottom:14px; font:900 13px/1 'Nunito', sans-serif; letter-spacing:1.5px;
|
||||
color:var(--yellow); opacity:.8; }
|
||||
@keyframes vfx-blink { 0% { opacity:1; } 50% { opacity:0; } }
|
||||
|
||||
/* the Power-up's / reward's Twitch icon as a sticker on the box's top-left corner */
|
||||
#vfx-box .ico { position:absolute; left:-30px; top:-30px; width:72px; height:72px; object-fit:contain; transform:rotate(-10deg); z-index:2;
|
||||
filter:drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff) drop-shadow(0 5px 8px rgba(0,0,0,.35)); }
|
||||
#vfx-box .ico[hidden] { display:none; }
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
if (vid) return;
|
||||
vid = document.createElement('video'); vid.id = 'vfx-video'; vid.playsInline = true; document.body.appendChild(vid);
|
||||
box = document.createElement('div'); box.id = 'vfx-box';
|
||||
box.innerHTML = '<div class="rec">● REC</div><div class="tc"></div><div class="title"></div><div class="who"></div><div class="amt"></div><div class="brand">POWER-UP</div>';
|
||||
box.innerHTML = '<img class="ico" alt=""><div class="rec">● REC</div><div class="tc"></div><div class="title"></div><div class="who"></div><div class="amt"></div><div class="brand">POWER-UP</div>';
|
||||
document.body.appendChild(box);
|
||||
fit(); addEventListener('resize', fit);
|
||||
}
|
||||
|
|
@ -31,6 +31,8 @@
|
|||
box.querySelector('.who').textContent = a.user || '';
|
||||
box.querySelector('.amt').textContent = a.bits ? `◆ ${a.bits} bits ◆` : '';
|
||||
box.querySelector('.tc').textContent = fmt(0);
|
||||
const ico = box.querySelector('.ico'); // the Power-up's / reward's Twitch icon, top-left corner
|
||||
if (a.icon) { ico.src = a.icon; ico.hidden = false; } else { ico.removeAttribute('src'); ico.hidden = true; }
|
||||
box.style.visibility = 'visible';
|
||||
box.animate([{ opacity: 0, transform: 'translateY(-12px)' }, { opacity: 1, transform: 'none' }], { duration: 400, easing: 'ease-out', fill: 'both' });
|
||||
clearInterval(tcTimer); tcTimer = setInterval(() => { box.querySelector('.tc').textContent = fmt(vid.currentTime); }, 250);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue