Screen Shortcut — Rotate The
/* Optional: Add rotation animation */ .rotating animation: rotateEffect 0.3s ease;
loadSavedPreferences() const saved = localStorage.getItem('screenRotation'); if (saved) const prefs = JSON.parse(saved); this.isAutoRotate = prefs.autoRotate; if (this.isAutoRotate) this.enableAutoRotate(); else this.rotateScreen(prefs.rotation); rotate the screen shortcut
// Initialize when DOM is ready document.addEventListener('DOMContentLoaded', () => new ScreenRotationShortcut(); ); // Add keyboard shortcut (Ctrl/Cmd + R for rotate) document.addEventListener('keydown', (e) => e.metaKey) && e.key === 'r') e.preventDefault(); const currentRotation = (parseInt(localStorage.getItem('lastRotation') ); 5. CSS Animation @keyframes fadeOut 0% opacity: 1; 70% opacity: 1; 100% opacity: 0; visibility: hidden; /* Optional: Add rotation animation */
setupEventListeners() // Toggle menu this.rotateBtn.addEventListener('click', (e) => e.stopPropagation(); this.rotationMenu.classList.toggle('active'); ); if (saved) const prefs = JSON.parse(saved)
// Rotation options document.querySelectorAll('[data-rotation]').forEach(btn => btn.addEventListener('click', (e) => const rotation = btn.getAttribute('data-rotation'); if (rotation === 'auto') this.enableAutoRotate(); else this.rotateScreen(parseInt(rotation)); this.rotationMenu.classList.remove('active'); ); );
.rotate-button:hover background: rgba(0, 0, 0, 0.9); transform: scale(1.05);