Show initial results without animation delay
Browse files- static/app.js +4 -4
- static/style.css +3 -4
static/app.js
CHANGED
|
@@ -879,7 +879,7 @@ async function doSearch() {
|
|
| 879 |
const newResults = data.results || [];
|
| 880 |
if (page === 1) {
|
| 881 |
STATE.results = newResults;
|
| 882 |
-
renderResults();
|
| 883 |
DOM.resultsContainer.scrollTop = 0;
|
| 884 |
} else {
|
| 885 |
STATE.results = STATE.results.concat(newResults);
|
|
@@ -945,7 +945,7 @@ function appendResults(items) {
|
|
| 945 |
observeResultSnippets();
|
| 946 |
}
|
| 947 |
|
| 948 |
-
function renderResults() {
|
| 949 |
resetSnippetObserver();
|
| 950 |
if (!STATE.results.length) {
|
| 951 |
DOM.resultsList.innerHTML = "";
|
|
@@ -956,7 +956,7 @@ function renderResults() {
|
|
| 956 |
}
|
| 957 |
DOM.emptyState.style.display = "none";
|
| 958 |
DOM.resultsList.innerHTML = STATE.results.map(resultItemHtml).join("");
|
| 959 |
-
animateResultRows(Array.from(DOM.resultsList.children).slice(0, 15));
|
| 960 |
DOM.multiActionBar.style.display = STATE.multiSelect ? "" : "none";
|
| 961 |
observeResultSnippets();
|
| 962 |
}
|
|
@@ -964,7 +964,7 @@ function renderResults() {
|
|
| 964 |
function animateResultRows(rows) {
|
| 965 |
if (!motionAllowed()) return;
|
| 966 |
rows.slice(0, 15).forEach((row, index) => {
|
| 967 |
-
row.style.setProperty("--result-enter-delay", `${Math.round(
|
| 968 |
row.classList.add("result-enter");
|
| 969 |
row.addEventListener("animationend", () => {
|
| 970 |
row.classList.remove("result-enter");
|
|
|
|
| 879 |
const newResults = data.results || [];
|
| 880 |
if (page === 1) {
|
| 881 |
STATE.results = newResults;
|
| 882 |
+
renderResults({ animate: true });
|
| 883 |
DOM.resultsContainer.scrollTop = 0;
|
| 884 |
} else {
|
| 885 |
STATE.results = STATE.results.concat(newResults);
|
|
|
|
| 945 |
observeResultSnippets();
|
| 946 |
}
|
| 947 |
|
| 948 |
+
function renderResults({ animate = false } = {}) {
|
| 949 |
resetSnippetObserver();
|
| 950 |
if (!STATE.results.length) {
|
| 951 |
DOM.resultsList.innerHTML = "";
|
|
|
|
| 956 |
}
|
| 957 |
DOM.emptyState.style.display = "none";
|
| 958 |
DOM.resultsList.innerHTML = STATE.results.map(resultItemHtml).join("");
|
| 959 |
+
if (animate) animateResultRows(Array.from(DOM.resultsList.children).slice(0, 15));
|
| 960 |
DOM.multiActionBar.style.display = STATE.multiSelect ? "" : "none";
|
| 961 |
observeResultSnippets();
|
| 962 |
}
|
|
|
|
| 964 |
function animateResultRows(rows) {
|
| 965 |
if (!motionAllowed()) return;
|
| 966 |
rows.slice(0, 15).forEach((row, index) => {
|
| 967 |
+
row.style.setProperty("--result-enter-delay", `${Math.round(24 * Math.sqrt(index))}ms`);
|
| 968 |
row.classList.add("result-enter");
|
| 969 |
row.addEventListener("animationend", () => {
|
| 970 |
row.classList.remove("result-enter");
|
static/style.css
CHANGED
|
@@ -1232,14 +1232,13 @@ body.mobile .multi-toggle { padding: 1px 4px; font-size: 11px; }
|
|
| 1232 |
}
|
| 1233 |
|
| 1234 |
.result-item.result-enter {
|
| 1235 |
-
animation: result-enter
|
| 1236 |
animation-delay: var(--result-enter-delay, 0ms);
|
| 1237 |
}
|
| 1238 |
|
| 1239 |
@keyframes result-enter {
|
| 1240 |
-
|
| 1241 |
-
|
| 1242 |
-
100% { opacity: 1; transform: translateY(0) scale(1); }
|
| 1243 |
}
|
| 1244 |
|
| 1245 |
.result-item:nth-child(even) {
|
|
|
|
| 1232 |
}
|
| 1233 |
|
| 1234 |
.result-item.result-enter {
|
| 1235 |
+
animation: result-enter 320ms cubic-bezier(0.2, 0, 0, 1) both;
|
| 1236 |
animation-delay: var(--result-enter-delay, 0ms);
|
| 1237 |
}
|
| 1238 |
|
| 1239 |
@keyframes result-enter {
|
| 1240 |
+
from { opacity: 0; transform: translateY(8px); }
|
| 1241 |
+
to { opacity: 1; transform: translateY(0); }
|
|
|
|
| 1242 |
}
|
| 1243 |
|
| 1244 |
.result-item:nth-child(even) {
|