// AI-Powered Model Discovery System class AIModelDiscovery { constructor() { this.isActive = true; this.rotationTimer = 15; this.rotationInterval = null; this.updateInterval = null; this.discoveryInterval = null; this.modelCount = 12847; this.discoveredToday = 0; // Sample model pool for rotation this.modelPool = [ { title: 'Modern Minimalist House', description: 'Contemporary residential design with clean lines and sustainable features', platform: 'GrabCAD', rating: 4.9, downloads: 2300, category: 'AI Curated', image: 'https://imagedelivery.net/xaKlCos5cTg_1RWzIu_h-A/b6f1cf92-9b03-42dd-dfc6-f16778882c00/public', dataMedia: '{"id":"2178614086","src":"iStock","type":"image"}', altText: 'Modern box house isometric isolated on blue background.3d rendering' }, { title: 'Multi-Story Residential', description: 'Urban residential complex with modern amenities and green spaces', platform: 'Thingiverse', rating: 4.7, downloads: 1800, category: 'Trending', image: 'https://imagedelivery.net/xaKlCos5cTg_1RWzIu_h-A/09f738bc-8d82-4379-eaf9-7da46b7c7000/public', dataMedia: '{"id":"1363859969","src":"iStock","type":"image"}', altText: 'Modern residential building at the white background. 3d illustration' }, { title: 'Abstract Architecture', description: 'Geometric architectural design with chrome and glass elements', platform: 'Wikifactory', rating: 5.0, downloads: 892, category: 'New', image: 'https://imagedelivery.net/xaKlCos5cTg_1RWzIu_h-A/1c5a2d3c-af89-424b-098f-239339a9c900/publicContain', dataMedia: '{"id":"2197728872","src":"iStock","type":"image"}', altText: '3d illustration of abstract minimal architecture background, geometric architectural with chrome or glass design' }, { title: 'Eco-Friendly Apartment', description: 'Sustainable apartment complex with green building technologies', platform: 'Fusion 360', rating: 4.8, downloads: 3100, category: 'Sustainable', image: 'https://imagedelivery.net/xaKlCos5cTg_1RWzIu_h-A/94ae246f-f700-45ba-e57f-3c9345100900/public', dataMedia: '{"id":"826385184","src":"iStock","type":"image"}', altText: '3D Apartment Rendering' }, { title: 'Construction Model', description: 'Detailed building construction model with comprehensive blueprints', platform: 'ActCAD', rating: 4.6, downloads: 1500, category: 'Blueprint', image: 'https://imagedelivery.net/xaKlCos5cTg_1RWzIu_h-A/f37a6fd3-f6c2-4f61-f96b-af70cfabdb00/public', dataMedia: '{"id":"636304660","src":"iStock","type":"image"}', altText: 'abstract 3d illustration of building construction computer model over blueprints' }, { title: 'Multi-Story Building', description: 'Contemporary multi-storey residential development model', platform: 'Cults3D', rating: 4.5, downloads: 967, category: 'High-Rise', image: 'https://imagedelivery.net/xaKlCos5cTg_1RWzIu_h-A/52a305ad-12c6-4b4a-f0d5-9e4189df5f00/publicContain', dataMedia: '{"id":"1094853292","src":"iStock","type":"image"}', altText: 'multi storey residential building. 3d illustration' } ]; this.platformColors = { 'GrabCAD': 'bg-blue-600', 'Thingiverse': 'bg-blue-600', 'Wikifactory': 'bg-purple-600', 'Fusion 360': 'bg-orange-600', 'ActCAD': 'bg-teal-600', 'Cults3D': 'bg-pink-600', 'Ultra Librarian': 'bg-purple-600', 'STLFinder': 'bg-indigo-600', 'Canva': 'bg-yellow-600' }; this.categoryColors = { 'AI Curated': 'bg-[var(--accent3-color)]', 'Trending': 'bg-[var(--accent-color)]', 'New': 'bg-[var(--accent4-color)]', 'Sustainable': 'bg-green-600', 'Blueprint': 'bg-[var(--accent2-color)]', 'High-Rise': 'bg-indigo-600' }; this.init(); } init() { this.setupEventListeners(); this.startRotationTimer(); this.startLiveUpdates(); this.startModelDiscovery(); this.animateCounters(); } setupEventListeners() { // AI control buttons const pauseBtn = document.getElementById('ai-pause-btn'); const refreshBtn = document.getElementById('ai-refresh-btn'); const manualRotate = document.getElementById('manual-rotate'); if (pauseBtn) { pauseBtn.addEventListener('click', () => this.toggleDiscovery()); } if (refreshBtn) { refreshBtn.addEventListener('click', () => this.forceRefresh()); } if (manualRotate) { manualRotate.addEventListener('click', () => this.manualRotation()); } // Filter change handlers const filters = ['ai-building-type', 'ai-style', 'ai-platform', 'ai-curation']; filters.forEach(filterId => { const filter = document.getElementById(filterId); if (filter) { filter.addEventListener('change', () => this.applyAIFilters()); } }); } startRotationTimer() { const timerElement = document.getElementById('rotation-timer'); this.rotationInterval = setInterval(() => { if (!this.isActive) return; this.rotationTimer--; if (timerElement) { timerElement.textContent = this.rotationTimer; } if (this.rotationTimer <= 0) { this.rotateModels(); this.rotationTimer = 15; } }, 1000); } startLiveUpdates() { this.updateInterval = setInterval(() => { this.updateLastUpdateTime(); this.updateModelCount(); }, 30000); // Update every 30 seconds } startModelDiscovery() { this.discoveryInterval = setInterval(() => { if (!this.isActive) return; this.simulateModelDiscovery(); }, 45000); // Discover new models every 45 seconds } rotateModels() { const grid = document.getElementById('ai-model-grid'); if (!grid) return; // Add fade out effect grid.style.opacity = '0.3'; grid.style.transform = 'scale(0.95)'; setTimeout(() => { this.shuffleAndUpdateModels(); // Fade back in grid.style.opacity = '1'; grid.style.transform = 'scale(1)'; }, 300); } shuffleAndUpdateModels() { const shuffled = [...this.modelPool].sort(() => Math.random() - 0.5); const selectedModels = shuffled.slice(0, 6); const grid = document.getElementById('ai-model-grid'); if (!grid) return; // Update each model card const cards = grid.querySelectorAll('.model-card'); cards.forEach((card, index) => { if (selectedModels[index]) { this.updateModelCard(card, selectedModels[index]); } }); } updateModelCard(card, model) { // Update image const img = card.querySelector('img'); if (img) { img.src = model.image; img.alt = model.altText; img.setAttribute('data-media', model.dataMedia); } // Update badges const badges = card.querySelectorAll('.absolute.top-4.left-4 span'); if (badges[0]) { badges[0].textContent = model.category; badges[0].className = `px-3 py-1 ${this.categoryColors[model.category]} text-white text-xs rounded-full font-medium`; } if (badges[1]) { badges[1].textContent = model.platform; badges[1].className = `px-3 py-1 ${this.platformColors[model.platform]} text-white text-xs rounded-full font-medium`; } // Update rating and downloads const rating = card.querySelector('.fas.fa-star').nextElementSibling; const downloads = card.querySelector('.text-sm:last-child'); if (rating) rating.textContent = model.rating; if (downloads) downloads.textContent = `${(model.downloads / 1000).toFixed(1)}K downloads`; // Update title and description const title = card.querySelector('h4'); const description = card.querySelector('p.text-white\\/70'); if (title) title.textContent = model.title; if (description) description.textContent = model.description; // Update discovery time const discoveryTime = card.querySelector('.text-white\\/70.text-sm'); if (discoveryTime) { const minutes = Math.floor(Math.random() * 20) + 1; discoveryTime.textContent = `Discovered ${minutes}m ago`; } } simulateModelDiscovery() { this.discoveredToday += Math.floor(Math.random() * 5) + 1; this.modelCount += Math.floor(Math.random() * 3) + 1; // Update counters const todayCounter = document.querySelector('[data-counter]'); const modelCountElement = document.getElementById('model-count'); if (todayCounter) { this.animateNumber(todayCounter, parseInt(todayCounter.textContent), this.discoveredToday); } if (modelCountElement) { modelCountElement.textContent = this.modelCount.toLocaleString(); } // Show discovery notification this.showDiscoveryNotification(); } showDiscoveryNotification() { const notification = document.createElement('div'); notification.className = 'fixed top-24 right-6 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg z-50 transform translate-x-full transition-transform duration-300'; notification.innerHTML = `