nicer text scroll

This commit is contained in:
Трошин Антон Валерьевич
2026-07-12 10:31:10 +03:00
parent 983190d146
commit 45c72fc4df
4 changed files with 13 additions and 8 deletions
+7 -1
View File
@@ -640,6 +640,11 @@ function toSubscript(n) {
return String(n).split('').map(d => SUBSCRIPTS[d]).join(''); return String(n).split('').map(d => SUBSCRIPTS[d]).join('');
} }
const TICKER_COLORS = [
'#7ec8e3', '#a8d5a2', '#f0c674', '#d4a0d4', '#e8a87c',
'#87ceeb', '#98d4bb', '#deb887', '#c9b1ff', '#ff9a9e'
];
const TICKER_SYSTEMS = [ const TICKER_SYSTEMS = [
{ key: 'binary', min: 1, max: 255, prefix: toSubscript(2) }, { key: 'binary', min: 1, max: 255, prefix: toSubscript(2) },
{ key: 'octal', min: 1, max: 511, prefix: toSubscript(8) }, { key: 'octal', min: 1, max: 511, prefix: toSubscript(8) },
@@ -661,7 +666,8 @@ function generateTickerText() {
const wrapped = sys.key === 'slavonic' const wrapped = sys.key === 'slavonic'
? '<span class="slavonic-font">' + prefixed + '</span>' ? '<span class="slavonic-font">' + prefixed + '</span>'
: prefixed; : prefixed;
pairs.push(wrapped + ' = ' + num); const color = TICKER_COLORS[Math.floor(Math.random() * TICKER_COLORS.length)];
pairs.push('<span style="color:' + color + '">' + wrapped + ' = ' + num + '</span>');
} }
return pairs.join('\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0'); return pairs.join('\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0');
} }
+3 -3
View File
@@ -10,7 +10,7 @@
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
<link rel="icon" type="image/svg+xml" href="icon.svg"> <link rel="icon" type="image/svg+xml" href="icon.svg">
<link rel="apple-touch-icon" href="icon-192.png"> <link rel="apple-touch-icon" href="icon-192.png">
<link rel="stylesheet" href="styles.css?v=38"> <link rel="stylesheet" href="styles.css?v=39">
</head> </head>
<body> <body>
<div id="app"> <div id="app">
@@ -155,10 +155,10 @@
</div> </div>
<script type="module" src="app.js?v=38"></script> <script type="module" src="app.js?v=39"></script>
<script> <script>
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js?v=38').catch(() => {}); navigator.serviceWorker.register('/sw.js?v=39').catch(() => {});
} }
</script> </script>
</body> </body>
+2 -3
View File
@@ -114,12 +114,11 @@ body {
font-size: 1.05rem; font-size: 1.05rem;
font-family: monospace; font-family: monospace;
animation: ticker-scroll 40s linear infinite; animation: ticker-scroll 40s linear infinite;
padding-left: 100%;
} }
@keyframes ticker-scroll { @keyframes ticker-scroll {
0% { transform: translateX(0); } 0% { transform: translateX(100%); }
100% { transform: translateX(-50%); } 100% { transform: translateX(-100%); }
} }
/* BUTTONS */ /* BUTTONS */
+1 -1
View File
@@ -1,4 +1,4 @@
const CACHE_NAME = 'numnum-v38'; const CACHE_NAME = 'numnum-v39';
const ASSETS = [ const ASSETS = [
'/', '/',
'/index.html', '/index.html',