Chat: paper slips under the camera, Twitch + 7TV emotes
- public/chat/chat.css + chat.js (window.HSChat): cream paper slips with the name on a washi-tape label, newest on top sliding out from under the webcam, older ones glide down and fade at the bottom; message_timeout / max_messages - Emotes: Twitch (tags.emotes) and 7TV global + channel sets (refreshed every 10 min), zero-width 7TV emotes stack, emote-only messages get bigger emotes - Deleted messages, timeouts, bans and /clear remove slips at once - overlay.ejs: old chat CSS/JS removed, new files load only for ?parts=chat Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0cc53e1d73
commit
463c6580f4
4 changed files with 264 additions and 55 deletions
71
public/chat/chat.css
Normal file
71
public/chat/chat.css
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/* Chat: cream paper slips with the name on a washi-tape label ("style 5" from the chat preview).
|
||||
The box sits under the webcam (Game scene: camera group at 1920,600, 640x360 on the 2560 canvas
|
||||
= 1440,450 480x270 on this 1920x1080 page). Newest message on top, slides out from under the camera,
|
||||
older ones are pushed down and dissolve at the bottom edge.
|
||||
Move or resize it with Custom CSS in Settings, e.g. #chat { --chat-top: 60%; --chat-height: 37%; } */
|
||||
#chat {
|
||||
--chat-right: 2%;
|
||||
--chat-top: 63%; /* 680px: just above the bottom of the camera ring, so messages come out from under it */
|
||||
--chat-width: 20%;
|
||||
--chat-height: 34%; /* down to the bottom edge */
|
||||
--ink: #3a2a20;
|
||||
--cream: #fffdf7;
|
||||
position: fixed;
|
||||
right: var(--chat-right);
|
||||
top: var(--chat-top);
|
||||
width: var(--chat-width);
|
||||
height: var(--chat-height);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
gap: 8px;
|
||||
padding: 26px 8px 0;
|
||||
overflow: hidden;
|
||||
-webkit-mask-image: linear-gradient(transparent 0, #000 30px, #000 calc(100% - 60px), transparent);
|
||||
mask-image: linear-gradient(transparent 0, #000 30px, #000 calc(100% - 60px), transparent);
|
||||
}
|
||||
|
||||
#chat .msg {
|
||||
position: relative;
|
||||
flex: none;
|
||||
margin: 9px 6px 0;
|
||||
padding: 19px 14px 9px;
|
||||
border-radius: 2px;
|
||||
background: var(--cream);
|
||||
color: var(--ink);
|
||||
font: 800 17px/1.3 Nunito, sans-serif;
|
||||
word-break: break-word;
|
||||
box-shadow: 0 3px 8px rgba(0, 0, 0, .35);
|
||||
transform: rotate(var(--tilt, 0deg));
|
||||
}
|
||||
#chat .msg.action { font-style: italic; }
|
||||
|
||||
/* the name on a strip of washi tape, tinted with the chatter's Twitch colour */
|
||||
#chat .msg .u {
|
||||
position: absolute;
|
||||
top: -12px;
|
||||
left: 10px;
|
||||
max-width: 85%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
padding: 1px 12px 2px;
|
||||
font: 700 23px/1 Caveat, cursive;
|
||||
color: var(--ink);
|
||||
background-color: var(--tape, rgba(201, 182, 228, .92));
|
||||
background-image: repeating-linear-gradient(45deg, #fff5 0 6px, #0000 6px 12px);
|
||||
transform: rotate(calc(var(--tilt, 0deg) * -2));
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
|
||||
clip-path: polygon(0 8%, 3% 0, 97% 4%, 100% 0, 98% 100%, 2% 94%);
|
||||
}
|
||||
|
||||
/* emotes (Twitch + 7TV). Zero-width 7TV emotes (RainTime, PETPET...) stack on the emote before them. */
|
||||
#chat .em { position: relative; display: inline-grid; vertical-align: -0.45em; margin: 0 1px; }
|
||||
#chat .em > img { grid-area: 1 / 1; height: 1.6em; width: auto; justify-self: center; align-self: center;
|
||||
filter: drop-shadow(0 0 1px rgba(58, 42, 32, .55)); } /* white emotes (Clap...) stay visible on cream */
|
||||
#chat .msg.big .em > img { height: 2.6em; } /* emote-only messages: bigger emotes */
|
||||
|
||||
#chat .msg.in { animation: chat-in .45s cubic-bezier(.2, 1.3, .4, 1) both; }
|
||||
#chat .msg.out { animation: chat-out .6s ease-in both; }
|
||||
@keyframes chat-in { from { opacity: 0; transform: translateY(-24px) rotate(calc(var(--tilt, 0deg) * -3)) scale(.95); } }
|
||||
@keyframes chat-out { to { opacity: 0; transform: translate(40px, 30px) rotate(calc(var(--tilt, 0deg) + 12deg)); } }
|
||||
Loading…
Add table
Add a link
Reference in a new issue