function mainSlide(selector, naviSelector, speed) { var tl = new TimelineMax(), t = TweenMax; var config = { $total : $(selector).find('.item').length, $now : 0, $next : 0, $prev : 0, $status : 0, $timer : '', $speed : speed, } function showSlide(n){ //현재 슬라이드거나 재생중일때 실행금지 => 애니메이션 끝나고 넘어감 if(config.$now === n || config.$status === 1) return false; var tween = { $slide : $(selector).find('.item'), $now : $(selector).find('.item.v0'+n), $con : $(selector).find('.item span'), $time : 3, } //init clearTimeout(config.$timer); config.$status = 1; tween.$now.find('.bg-video-wrap').hide(); t.set(tween.$now, {zIndex:'2', display : 'block'}); //현재 슬라이드 //네비게이션 $(naviSelector).find('li').removeClass('on'); $(naviSelector).find('li:eq(' + (n - 1) + ')').addClass('on'); //안드로이드가 아닐때 if(!$('html').is('.android')) { $(selector).find('.item span').removeAttr('style'); //span 스타일 초기화 if($('#wrap').hasClass('first')===false){ //첫 슬라이드 시작시 애니메이션 off t.set(tween.$now.find('span'), {'width' : '0'}); } //비디오 if(tween.$now.is('.video')) { //init tween.$now.find('video').get(0).pause(); if(!$('html').is('.mobile')) { //모바일 동영상 재생 금지 tween.$now.find('video').get(0).currentTime = 0; clearTimeout(videoLoad); var videoLoad= setTimeout(function(){ tween.$now.find('.bg-video-wrap').stop(true).show(); tween.$now.find('video').get(0).play(); }, config.$speed - 2300); } } t.staggerTo(tween.$now.find('span'), tween.$time, { css: { width:'20%', }, ease:Power4.easeInOut, //이징효과 onComplete:moveSlide, //호출 함수 }, .2); //안드로이드일때 } else { t.fromTo(tween.$now.find('.img'), tween.$time, {opacity:0}, {opacity:1, onComplete:moveSlide}); } //콜백함수 function moveSlide(){ tween.$slide.removeAttr('style').removeClass('current'); //새로운 슬라이드 애니메이션 끝난 후 지워줌 tween.$now.addClass('current'); //애니메이션 끝난 후 현재 슬라이드에게 클래스 붙여줌 animateEnd(); //호출 함수 } function animateEnd(){config.$status = 0; $('#wrap').removeClass('first');} // 애니메이션 끝나고 다음 슬라이드 재생, 첫 애니메이션 삭제 config.$now = n; config.$next = (n + 1 > config.$total) ? 1 : ( n + 1 ); config.$prev = (n - 1 < 1) ? config.$total : ( n - 1 ) ; config.$timer = setTimeout(function(){ //자동재생 showSlide(config.$next); }, config.$speed); }//showSlide $(selector).find('.item').each(function (i){ $(naviSelector).append('
  • '); }); $(naviSelector).find('li').on('click', function() { var index = $(naviSelector).find('li').index($(this)); showSlide(index + 1); }); showSlide(1); } //end function loadingPage(){ var $time = 1000; $('#svg_ah1').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 100 + $time }); $('#svg_ah2').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 200 + $time }); $('#svg_ah3').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 300 + $time }); $('#svg_reum1').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 400 + $time }); $('#svg_reum2').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 500 + $time }); $('#svg_reum3').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 600 + $time }); $('#svg_da1').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 700 + $time }); $('#svg_da2').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 800 + $time }); $('#svg_da3').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 900 + $time }); $('#svg_da4').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1000 + $time }); $('#svg_un1').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1100 + $time }); $('#svg_un2').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1200 + $time }); $('#svg_un3').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1300 + $time }); $('#svg_un4').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1400 + $time }); $('#svg_lee1').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1500 + $time }); $('#svg_lee2').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1600 + $time }); $('#svg_ya1').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1700 + $time }); $('#svg_ya2').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1800 + $time }); $('#svg_ya3').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 1900 + $time }); $('#svg_ya4').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 2000 + $time }); $('#svg_gi1').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 2100 + $time }); $('#svg_gi2').velocity({ 'stroke-dashoffset': 569 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 900, delay: 2200 + $time }); $('.svg_line1').velocity({ 'stroke-dashoffset': 300 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 300, delay: 3700 }, "easeInOut"); $('.svg_line2').velocity({ 'stroke-dashoffset': 300 }, { duration: 0, delay: 0 }).velocity({ 'stroke-dashoffset': 0 }, { duration: 300, delay: 3800 }, "easeInOut"); } function textHoverLine() { $('.main-text').hover(function() { $('.outline').addClass('on'); }, function(){ $('.outline').removeClass('on'); }); } function sessionState() { var loadPage; if(!sessionStorage.getItem(loadPage)) { $('#intro-page').show(); setTimeout(function() { $('#intro-page').stop(true).fadeOut(300); sessionStorage.setItem(loadPage, true); }, 5200); }else { $('#intro-page').remove(); } } $(function(){ //init setTimeout(function() { $('body').addClass('ani'); }, 200); sessionState(); loadingPage(); mainSlide('.main_slide', '.main_slide_indicator ul', 6000); textHoverLine(); }); //end