Add Day-Part Clock Animator and multiple animation options for various displays

- Implemented a new Day-Part Clock Animator in `solutions-animator.js` that updates a clock and badge based on simulated time.
- Updated `index.php` to include new animation options for lobby, conference, day-part, wayfinding, storefront, announcement, campus wayfinding, emergency, enclosure, brightness, cellular, designer, media library, publish, screen groups, monitoring, patient wayfinding, waiting room, multi-zone, and membership displays.
- Each animation option includes HTML structure for respective displays.
This commit is contained in:
Matt Batchelder
2026-03-16 22:32:57 -04:00
parent fa6dce039b
commit ff5f392236
11 changed files with 1621 additions and 25 deletions

View File

@@ -289,3 +289,66 @@
boot();
}
})();
/* ── 3. Day-Part Clock Animator ────────────────────────────────────────── */
(function () {
'use strict';
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
function initDaypart(stage) {
var clockEl = stage.querySelector('[data-daypart-clock]');
var badgeEl = stage.querySelector('[data-daypart-badge]');
if (!clockEl || !badgeEl) return;
var visible = true;
var observer = new IntersectionObserver(function (entries) {
visible = entries[0].isIntersecting;
}, { threshold: 0.1 });
observer.observe(stage);
var simHour = 7;
var simMin = 0;
var parts = ['Morning', 'Afternoon', 'Evening'];
function pad(n) { return n < 10 ? '0' + n : '' + n; }
function tick() {
if (!visible) { requestAnimationFrame(tick); return; }
simMin += 1;
if (simMin >= 60) { simMin = 0; simHour = (simHour + 1) % 24; }
var displayHour = simHour % 12 || 12;
var ampm = simHour < 12 ? 'AM' : 'PM';
clockEl.textContent = displayHour + ':' + pad(simMin) + ' ' + ampm;
if (simHour >= 5 && simHour < 12) {
badgeEl.textContent = parts[0];
} else if (simHour >= 12 && simHour < 17) {
badgeEl.textContent = parts[1];
} else {
badgeEl.textContent = parts[2];
}
requestAnimationFrame(tick);
}
requestAnimationFrame(tick);
}
function boot() {
var stages = document.querySelectorAll('.daypart-stage');
for (var i = 0; i < stages.length; i++) {
if (stages[i]._daypartAnim) continue;
stages[i]._daypartAnim = true;
initDaypart(stages[i]);
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', boot);
} else {
boot();
}
})();