TTS: allow up to 500 characters, smaller handwriting on the letter for long messages

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-11-21 15:03:07 +02:00
parent 50fd4b1cad
commit cf90b6be54
5 changed files with 12 additions and 7 deletions

View file

@ -46,9 +46,14 @@
@keyframes fx-flap { from { transform:rotateX(180deg); z-index:4; } }
#fx-alert .envl .slot { position:absolute; left:-40px; right:-40px; bottom:0; top:-400px; overflow:hidden; z-index:2; animation:fx-zswap 1.6s .8s both; }
@keyframes fx-zswap { 0%, 54% { z-index:2; } 55%, 100% { z-index:6; } }
#fx-alert .envl .letter { position:absolute; left:62px; bottom:30px; width:316px; min-height:290px; background:#fffdf7; padding:18px 22px 22px;
#fx-alert .envl .letter { --fs:24px; --lh:30px; position:absolute; left:62px; bottom:30px; width:316px; min-height:290px; background:#fffdf7; padding:18px 22px 22px;
box-shadow:0 4px 12px rgba(0,0,0,.3); animation:fx-rise 1.6s .8s both;
background-image:repeating-linear-gradient(transparent 0 29px, rgba(110,150,200,.3) 29px 30px); background-position:0 46px; }
background-image:repeating-linear-gradient(transparent 0 calc(var(--lh) - 1px), rgba(110,150,200,.3) calc(var(--lh) - 1px) var(--lh));
background-position:0 calc(22px + var(--lh) - 6px); }
/* longer messages: smaller handwriting, the ruled lines follow */
#fx-alert .envl .letter.long { --fs:20px; --lh:25px; }
#fx-alert .envl .letter.longer { --fs:17px; --lh:21px; width:340px; }
#fx-alert .envl .letter.huge { --fs:15px; --lh:18px; width:356px; }
@keyframes fx-rise {
0% { transform:translateY(110px); animation-timing-function:cubic-bezier(.3,.7,.4,1); }
45% { transform:translateY(-200px) rotate(-1deg); }
@ -56,7 +61,7 @@
100% { transform:translateY(-14px) rotate(-2deg); }
}
#fx-alert .envl .to { font:700 22px/1 Caveat, cursive; color:var(--red); margin-bottom:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#fx-alert .envl .tx { font:700 24px/30px Caveat, cursive; color:var(--ink); word-wrap:break-word; }
#fx-alert .envl .tx { font:700 var(--fs)/var(--lh) Caveat, cursive; color:var(--ink); word-wrap:break-word; }
#fx-alert .envl .w { opacity:.12; transition:opacity .25s; }
#fx-alert .envl .w.on { opacity:1; }
#fx-alert .envl .seal { position:absolute; left:157px; bottom:86px; width:46px; height:46px; z-index:5; border-radius:50%; background:#b74347;

View file

@ -156,7 +156,7 @@
const text = d.msg || '';
const words = text.split(/\s+/).filter(Boolean);
el.innerHTML = `<div class="envl"><div class="flap"></div>
<div class="slot"><div class="letter"><div class="to">from ${esc(d.name)} ♡</div>
<div class="slot"><div class="letter ${text.length > 340 ? 'huge' : text.length > 230 ? 'longer' : text.length > 140 ? 'long' : ''}"><div class="to">from ${esc(d.name)} ♡</div>
<div class="tx">${words.map(w => `<span class="w">${esc(w)}</span>`).join(' ')}</div></div></div>
<div class="env"></div><div class="seal">♥</div></div>`;
el.style.visibility = 'visible';