// 스크롤 애니메이션 함수 (AI 서비스 페이지에서는 비활성화) function handleScrollAnimation() { // AI 서비스 페이지에서는 애니메이션을 비활성화 if (window.location.pathname.includes('ax-ai-service.html')) { return; } const observerOptions = { threshold: 0.1, rootMargin: '0px 0px -50px 0px' }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { // stagger-animation 클래스가 있는 경우 순서대로 애니메이션 if (entry.target.classList.contains('stagger-animation')) { // Performance 카드(메인 성과) 영역 애니메이션 처리 if (entry.target.closest('.main-performance-list')) { const container = entry.target.closest('.main-performance-list'); const staggerElements = container.querySelectorAll('.stagger-animation'); staggerElements.forEach((el, index) => { setTimeout(() => { el.classList.add('animate'); if (el.classList.contains('main-performance-item')) { el.style.animationPlayState = 'running'; } }, index * 200); }); return; } // Partner 로고 카드: stagger 없이 한 번에 모두 animate if (entry.target.closest('.main-partner-logos')) { const container = entry.target.closest('.main-partner-logos'); const staggerElements = container.querySelectorAll('.stagger-animation'); staggerElements.forEach((el) => { el.classList.add('animate'); }); return; } // 그 외 섹션은 기존대로 200ms const container = entry.target.closest('.main-contact-inner, .main-tech-list, .main-visual-services'); if (container) { const staggerElements = container.querySelectorAll('.stagger-animation'); staggerElements.forEach((el, index) => { setTimeout(() => { el.classList.add('animate'); if (el.classList.contains('main-performance-item')) { el.style.animationPlayState = 'running'; } }, index * 200); }); } } else { entry.target.classList.add('is-visible'); } } }); }, observerOptions); // 애니메이션 효과를 받는 요소들을 관찰 const animatedElements = document.querySelectorAll('.fade-in-section, .slide-in-left, .slide-in-right, .scale-in, .stagger-animation'); animatedElements.forEach(el => { observer.observe(el); }); } // Section Navigation function handleSectionNavigation() { const sectionNavItems = document.querySelectorAll('.section-nav-item'); sectionNavItems.forEach(item => { item.addEventListener('click', function () { const targetSection = this.getAttribute('data-section'); const targetElement = document.getElementById(targetSection); if (targetElement) { const menuHeight = 80; const targetPosition = targetElement.offsetTop - menuHeight; window.scrollTo({ top: targetPosition, behavior: 'smooth' }); // 활성 상태 업데이트 sectionNavItems.forEach(navItem => navItem.classList.remove('active')); this.classList.add('active'); } }); }); } // 스크롤 위치에 따른 section-nav 활성 상태 업데이트 function updateActiveSection() { const sections = document.querySelectorAll('section[id]'); const sectionNavItems = document.querySelectorAll('.section-nav-item'); const menuHeight = 80; let currentSection = ''; sections.forEach(section => { const sectionTop = section.offsetTop - menuHeight; const sectionHeight = section.offsetHeight; const scrollPosition = window.scrollY; if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight) { currentSection = section.getAttribute('id'); } }); sectionNavItems.forEach(item => { item.classList.remove('active'); if (item.getAttribute('data-section') === currentSection) { item.classList.add('active'); } }); } // Performance 섹션에서 메뉴 스타일 변경 함수 function handlePerformanceMenuStyle() { const topArea = document.querySelector('.top-area'); const performanceSection = document.getElementById('main-performance-area'); if (!topArea || !performanceSection) return; const observerOptions = { threshold: 0.1, rootMargin: '-80px 0px -80px 0px' // 메뉴 높이만큼 여백 }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { // Performance 섹션 스타일 적용 topArea.classList.add('performance-style'); } else { // Performance 섹션 스타일 제거吏€ ?딆쓣 ?? topArea.classList.remove('performance-style'); } }); }, observerOptions); observer.observe(performanceSection); } // Smooth scroll to next section on click function handleScrollDown() { var scrollDown = document.querySelector('.scroll-down-bottom'); if (scrollDown) { scrollDown.addEventListener('click', function () { var nextSection = document.getElementById('multimodal-mlops'); if (nextSection) { nextSection.scrollIntoView({ behavior: 'smooth' }); } }); scrollDown.addEventListener('keypress', function (e) { if (e.key === 'Enter' || e.key === ' ') { var nextSection = document.getElementById('multimodal-mlops'); if (nextSection) { nextSection.scrollIntoView({ behavior: 'smooth' }); } } }); } } // Top Button 기능 function handleTopButton() { var topBtn = document.getElementById('topBtn'); if (!topBtn) { return; } window.addEventListener('scroll', function () { if (window.pageYOffset > 300) { topBtn.style.display = 'flex'; } else { topBtn.style.display = 'none'; } }); topBtn.addEventListener('click', function () { window.scrollTo({ top: 0, behavior: 'smooth' }); }); } // 숫자 카운트 애니메이션 함수 (AI 서비스 페이지에서는 비활성화) function handleNumberCountAnimation() { // AI 서비스 페이지에서는 애니메이션을 비활성화 if (window.location.pathname.includes('ax-ai-service.html')) { return; } const numberElements = document.querySelectorAll('.ip-patent-field-num'); if (numberElements.length === 0) return; const observerOptions = { threshold: 0.5, rootMargin: '0px 0px -100px 0px' }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { const targetElement = entry.target; const targetNumber = parseInt(targetElement.getAttribute('data-count') || '0'); const duration = 2000; // 2초 const step = targetNumber / (duration / 16); // 60fps 기준 let currentNumber = 0; const animate = () => { currentNumber += step; if (currentNumber >= targetNumber) { currentNumber = targetNumber; targetElement.querySelector('span').textContent = currentNumber; return; } targetElement.querySelector('span').textContent = Math.floor(currentNumber); requestAnimationFrame(animate); }; animate(); observer.unobserve(targetElement); // 한 번만 실행되도록 } }); }, observerOptions); numberElements.forEach(el => observer.observe(el)); } // 메인 이미지 최우선 로딩 처리 function handleMainImagePreload() { const mainImage = document.querySelector('.main-bg-preload'); if (mainImage) { // 이미지가 이미 로드된 경우 if (mainImage.complete) { mainImage.classList.add('loaded'); } else { // 이미지 로딩 완료 시 처리 mainImage.addEventListener('load', function() { this.classList.add('loaded'); }); // 이미지 로딩 실패 시 처리 mainImage.addEventListener('error', function() { console.warn('메인 이미지 로딩 실패:', this.src); }); } } } // 메인 비주얼 타이틀 전환 처리 function handleMainVisualTitleRotation() { const titles = document.querySelectorAll('.main-visual-title'); if (titles.length <= 1) return; let currentIndex = 0; let progressIndex = 0; // 현재 채워진 progress 인덱스 // 모든 progress-fill을 초기화하는 함수 function resetAllProgressFills() { titles.forEach(title => { const progressFills = title.querySelectorAll('.progress-fill'); progressFills.forEach(fill => { fill.style.animation = 'none'; fill.style.animationPlayState = 'paused'; }); }); } // 특정 progress-fill을 채우는 함수 function fillProgress(titleIndex, progressIndex) { const targetTitle = titles[titleIndex]; const progressFills = targetTitle.querySelectorAll('.progress-fill'); if (progressFills[progressIndex]) { progressFills[progressIndex].style.animation = ''; progressFills[progressIndex].style.animationPlayState = 'running'; } } // 모든 타이틀의 progress를 누적해서 채우는 함수 function fillAllProgresses() { titles.forEach((title, titleIdx) => { const progressFills = title.querySelectorAll('.progress-fill'); progressFills.forEach((fill, fillIdx) => { if (fillIdx <= progressIndex) { fill.style.animation = ''; fill.style.animationPlayState = 'running'; } }); }); } // 페이지 로드 시 첫 번째 progress 시작 fillProgress(0, 0); function showNextTitle() { // 현재 타이틀에 사라지는 애니메이션 적용 const currentTitle = titles[currentIndex]; currentTitle.style.animation = 'slideOutToLeft 0.5s ease-out forwards'; // 다음 타이틀 인덱스 계산 currentIndex = (currentIndex + 1) % titles.length; // progress 인덱스 증가 progressIndex++; // 다음 타이틀 표시 (약간의 딜레이 후) setTimeout(() => { // 현재 타이틀 숨기기 currentTitle.style.display = 'none'; currentTitle.style.animation = ''; // 다음 타이틀 표시 const nextTitle = titles[currentIndex]; nextTitle.style.display = 'flex'; // progress가 3개 모두 채워졌으면 초기화 if (progressIndex >= 3) { resetAllProgressFills(); progressIndex = 0; // 첫 번째 progress 다시 시작 fillProgress(currentIndex, 0); } else { // 누적해서 progress 채우기 fillAllProgresses(); } }, 500); // 0.5초 딜레이 } // 6초마다 타이틀 전환 setInterval(showNextTitle, 6000); } // document.addEventListener('DOMContentLoaded', function () { // 메인 이미지 최우선 로딩 처리 handleMainImagePreload(); // 메인 비주얼 타이틀 전환 처리 handleMainVisualTitleRotation(); handleScrollAnimation(); handleSectionNavigation(); handlePerformanceMenuStyle(); handleScrollDown(); handleTopButton(); handleNumberCountAnimation(); }); // 스크롤 이벤트 리스너 추가 window.addEventListener('scroll', updateActiveSection);