Add shimmer
This commit is contained in:
parent
2b9ca9ad31
commit
69943d15ec
|
|
@ -22,7 +22,7 @@
|
|||
{ "date": 1746126240, "text": "Added 1% Coyote Cum." },
|
||||
{ "date": 1751396678, "text": "CV'd Zae~" },
|
||||
{ "date": 1751407200, "text": "Zae added 41% Kan'vi Cum" },
|
||||
{ "date": 1751493600, "text": "Added 1% Coyote Cum." },
|
||||
{ "date": 1751547600, "text": "Added 1% Coyote Cum." },
|
||||
{ "date": 1751569534, "text": "Dumped 40% into Ky-Li" }
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,11 +143,33 @@
|
|||
const logList = document.getElementById("logList");
|
||||
logList.innerHTML = "";
|
||||
if (tankData.logs) {
|
||||
const now = Date.now() / 1000;
|
||||
tankData.logs.forEach(log => {
|
||||
const li = document.createElement("li");
|
||||
// If log.date is a string, try to parse as epoch seconds
|
||||
let epoch = typeof log.date === 'number' ? log.date : Date.parse(log.date) / 1000;
|
||||
// timesago expects ms
|
||||
const ageHours = (now - epoch) / 3600;
|
||||
|
||||
// Color interpolation: 0h = #fff, 8h = #888
|
||||
let color;
|
||||
if (ageHours <= 0) {
|
||||
color = "#fff";
|
||||
} else if (ageHours >= 8) {
|
||||
color = "#888";
|
||||
} else {
|
||||
// Linear interpolation between #fff and #888
|
||||
const t = ageHours / 8;
|
||||
const r = Math.round(255 + (136 - 255) * t);
|
||||
const g = Math.round(255 + (136 - 255) * t);
|
||||
const b = Math.round(255 + (136 - 255) * t);
|
||||
color = `rgb(${r},${g},${b})`;
|
||||
}
|
||||
li.style.color = color;
|
||||
|
||||
// Add shimmer class if less than 8 hours old
|
||||
if (ageHours < 8) {
|
||||
li.classList.add("log-shimmer");
|
||||
}
|
||||
|
||||
li.textContent = `${window.timesago ? timesago(epoch * 1000) : log.date} — ${log.text}`;
|
||||
logList.appendChild(li);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -219,3 +219,30 @@ h1 {
|
|||
font-size: 0.95em;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.log-shimmer {
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
#fff 0%,
|
||||
#f8f8ff 20%,
|
||||
#ffe 40%,
|
||||
#fff 60%,
|
||||
#e0e0e0 80%,
|
||||
#fff 100%
|
||||
);
|
||||
background-size: 400% 100%;
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
animation: shimmer 6s linear infinite;
|
||||
font-weight: bold;
|
||||
filter: drop-shadow(0 0 2px #fff8);
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% {
|
||||
background-position: 400% 0;
|
||||
}
|
||||
100% {
|
||||
background-position: 0 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue