var mainMotions = new Array(); var loopLimit = 4; var currentMainMotionIndex = 0; var nextMotion = -1; var isMainMotionPause = false; var loop1, loop2, loop3, loop4, loop5; var loopTimeout; var mainMotion1Timeout; var mainMotion2Timeout; var mainMotion3Timeout; var mainVideoPlaying = false; var currentMainVideoIndex = -1; var currentMainPromotionIndex = 0; $(document).ready(function(){ $("#motion_area").css("display", "block"); // ¸ÞÀθð¼Ç1 var mainMotion = new TimelineMax({onStart:setMainMotionButton, onStartParams:[0], onReverseComplete:showNextMain, onComplete:mainLoop, onCompleteParams:[0]}); mainMotion.from($("#motion_img1_1"), 1, { ease:Expo.easeOut, alpha:0, right : "-=0" }) .from($("#motion_img1_2"), 1, { ease:Expo.easeOut, alpha:0, top : "+=50" }, "-=0.8") .from($("#motion_img1_4"), 1, { ease:Expo.easeOut, alpha:0, top : "+=50" }, "-=0.8") .from($("#motion_title1_1"), 1, { ease:Expo.easeOut, alpha:0, left : "-=50" }, "-=0.8") .from($("#motion_title1_2"), 1, { ease:Expo.easeOut, alpha:0, left : "-=100" }, "-=0.8") .from($("#motion_title1_3"), 1, { ease:Expo.easeOut, alpha:0, top : "+=50" }, "-=0.8") .from($("#motion_img1_3"), 1, { ease:Expo.easeOut, alpha:0, top : "+=50" }, "-=0.8") .from($("#motion_icon1_1"), 1, { ease:Expo.easeOut, alpha:0, left : "+=50", top: "+=50" }, "-=0.8") .from($("#motion_icon1_2"), 1, { ease:Expo.easeOut, alpha:0, top: "+=50" }, "-=0.8") .from($("#motion_icon1_3"), 1, { ease:Expo.easeOut, alpha:0, left : "-=50", top: "+=50" }, "-=0.8"); mainMotion.pause(); mainMotions.push(mainMotion); // ¸ÞÀθð¼Ç2 mainMotion = new TimelineMax({onStart:setMainMotionButton, onStartParams:[1], onReverseComplete:showNextMain, onComplete:mainLoop, onCompleteParams:[1]}); mainMotion.from($("#motion_tab2_1"), 1, { ease:Expo.easeOut, alpha:0, right : "-=1000" }) .from($("#motion_title2_1"), 1, { ease:Expo.easeOut, alpha:0, left : "-=50" }, "-=0.8") .from($("#motion_title2_2"), 1, { ease:Expo.easeOut, alpha:0, left : "-=100" }, "-=0.8") .from($("#motion_title2_3"), 1, { ease:Expo.easeOut, alpha:0, top : "+=50" }, "-=0.8") .from($("#motion_img2_1"), 1, { ease:Expo.easeOut, alpha:0, left : "+=0", top: "+=0" }, "-=0.8"); mainMotion.pause(); mainMotions.push(mainMotion); // ¸ÞÀθð¼Ç2¿¡ ÀÖ´Â ¾ÆÀÌÅÛµé ÃʱⰪ ¼³Á¤. TweenMax.set($("#motion_thumb_people2, #motion_thumb_people3, #motion_thumb_people4"), {alpha:0}); $("#motion_info_txt2, #motion_info_txt3, #motion_info_txt4").css("display", "none"); // ¸ÞÀθð¼Ç2¿¡ ÀÖ´Â ÅǸŴº ¾î¹ö½Ã Çڵ鷯 µî·Ï $("#motion_tab2_1").mouseover(function(){ setMotionTab(1); }); $("#motion_tab2_2").mouseover(function(){ setMotionTab(2); }); $("#motion_tab2_3").mouseover(function(){ setMotionTab(3); }); $("#motion_tab2_4").mouseover(function(){ setMotionTab(4); }); // ¸ÞÀθð¼Ç3 mainMotion = new TimelineMax({onStart:setMainMotionButton, onStartParams:[2], onReverseComplete:showNextMain, onComplete:mainLoop, onCompleteParams:[2]}); mainMotion.from($("#motion_tab2_1"), 1, { ease:Expo.easeOut, alpha:0, right : "-=1000" }) .from($("#motion_title3_1"), 1, { ease:Expo.easeOut, alpha:0, left : "-=50" }, "-=0.8") .from($("#motion_title3_2"), 1, { ease:Expo.easeOut, alpha:0, left : "-=100" }, "-=0.8") .from($("#motion_title3_3"), 1, { ease:Expo.easeOut, alpha:0, top : "+=50" }, "-=0.8") .from($("#motion_img3_1"), 1, { ease:Expo.easeOut, alpha:0, left : "+=0", top: "+=0" }, "-=0.8"); mainMotion.pause(); mainMotions.push(mainMotion); // ¸¶¿ì½º ¿À¹ö½Ã ·çÇÁ ½ºÅ¾ ¾Æ¿ô½Ã 4ÃÊ ÈÄ ·çÇÁ Àç»ý $("#motion_area").hover(function(){ playLoopState(); }, function(){ playLoopState(); }); // ¿µ»ó Á¦¾î $("#mainPlayerThumb0, #mainPlayerThumb1, #mainPlayerThumb2").click(function(){ var index = $(this).attr("id").substring(15); playMainVideo(index); }); // ÇÁ·Î¸ð¼Ç Á¤º¸ ºÒ·¯¿À±â. getMainPromotionData(); // ¸ð¼Ç ½ÃÀÛ. var randIndex = Math.floor(Math.random() * 1); showMotion(randIndex); }); // ÇÁ·Î¸ð¼Ç Á¤º¸ XML ·Îµù function getMainPromotionData() { } // ¸ÞÀοµ»ó Àç»ý function playMainVideo(index) { if(index == undefined || index == null) index = 0; else if(currentMainVideoIndex == index) return; // ½æ³×ÀÏ È£¹ö È¿°ú if(currentMainVideoIndex > -1) { // ÀÌÀü ½æ³×ÀÏÀº ¿ø»óº¹±Í $("#mainPlayerThumbCover" + currentMainVideoIndex).css("display", "block"); } currentMainVideoIndex = index; $("#mainPlayerThumbCover" + currentMainVideoIndex).css("display", "none"); // µ¿¿µ»ó Àç»ý changeMovie(mainMovieUrlArr[currentMainVideoIndex]); clearTimeout(mainMotion2Timeout); } // ¸ÞÀοµ»ó ÁßÁö function stopMainVideo() { pauseMovie(); } // ·çÇÁ »óÅ Á¤Áö ÇÏ°í ´ÙÀ½ ¸ð¼ÇÀ¸·Î ³Ñ°Å°¡°Ô ÇÏ´Â ÇÔ¼ö. function stopLoopState() { isMainMotionPause = true; clearTimeout(loopTimeout); switch(currentMainMotionIndex) { case 0: if(loop3 == null || loop3 == undefined) return; loop1.repeat(-1); loop2.repeat(-1); loop3.repeat(-1); break; case 1: clearTimeout(mainMotion1Timeout); break; case 2: clearTimeout(mainMotion2Timeout); break; } } // ¸¶¿ì½º ¿À¹ö½Ã ÇÑ È­¸é¿¡¼­ ·çÇÁ¸¦ °è¼Ó µ¹°Ô ÇÏ´Â ÇÔ¼ö. function playLoopState(isNow) { isMainMotionPause = false; if(isNow && mainVideoPlaying == false) { switch(currentMainMotionIndex) { case 0: loop1.repeat(loopLimit); loop2.repeat(loopLimit); loop3.repeat(loopLimit); break; case 1: mainLoop(1); break; case 2: mainLoop(2); break; } } else { clearTimeout(loopTimeout); loopTimeout = setTimeout((function(param) { return function() { playLoopState(param); }; })(true), 5000); } } // ´ÙÀ½ ¸ð¼ÇÀ¸·Î À̵¿ÇÏ°Ô ÇÏ´Â ÇÔ¼ö. function showNextMain() { if(nextMotion == -1) nextMotion = currentMainMotionIndex + 1; if(nextMotion > 2) nextMotion = 0; showMotion(nextMotion); nextMotion = -1; } // ¸ð¼ÇÀ» ƯÁ¤ À§Ä¡·Î À̵¿ÇÏ°Ô ÇÏ´Â ÇÔ¼ö. function skipMotion(index) { if(currentMainMotionIndex == 2) stopMainVideo(); nextMotion = index; hideMotion(currentMainMotionIndex); clearTimeout(loopTimeout); } // ¸ÞÀθð¼Ç ¹öÆ° Çڵ鷯 function setMainMotionButton(index) { if(index == currentMainMotionIndex) return; $("#mainMotionBtn" + currentMainMotionIndex).attr("src", $("#mainMotionBtn" + currentMainMotionIndex).attr("src").replace("_on", "_off")); currentMainMotionIndex = index; $("#mainMotionBtn" + currentMainMotionIndex).attr("src", $("#mainMotionBtn" + currentMainMotionIndex).attr("src").replace("_off", "_on")); } // ¸ÞÀηçÇÁ ¼³Á¤ function mainLoop(index) { switch(index) { case 0: var loopCount = loopLimit; if(isMainMotionPause) { loopCount = -1; } loop1 = TweenMax.to($("#motion_icon1_1"), 0.7, {ease:Linear.easeNone, top: "-=10", yoyo:true, repeat:loopCount, onComplete :hideMotion, onCompleteParams:[0]}); loop2 = TweenMax.to($("#motion_icon1_2"), 0.7, {ease:Linear.easeNone, top: "-=10", yoyo:true, repeat:loopCount}); loop3 = TweenMax.to($("#motion_icon1_3"), 0.7, {ease:Linear.easeNone, top: "-=10", yoyo:true, repeat:loopCount}); break; case 1: clearTimeout(mainMotion1Timeout); if(isMainMotionPause) return; mainMotion1Timeout = setTimeout((function(param) { return function() { hideMotion(param); }; })(1), 5000); break; case 2: // ù¹ø° ¿µ»ó º¸À̱⸸ ÇÏ°í Ç÷¡ÀÌ´Â ¾ÈÇÔ. $("#videoContainer").css({width:"100%", height:"100%"}); playMainVideo(0); pauseMovie(); clearTimeout(mainMotion2Timeout); if(isMainMotionPause) return; mainMotion2Timeout = setTimeout((function(param) { return function() { if(mainVideoPlaying) return; stopMainVideo(); hideMotion(param); }; })(2), 5000); break; } } // ³ª¿À´Â ¸ð¼Ç function showMotion(index) { $("#mainMotionArea" + currentMainMotionIndex).css("display", "none"); $("#mainMotionArea" + index).css("display", "block"); $("#mainMotionArea" + index).stop().animate({"opacity" : "1"}); mainMotions[index].timeScale(1.5); mainMotions[index].play(); } // »ç¶óÁö´Â ¸ð¼Ç function hideMotion(index) { mainMotions[index].timeScale(3); mainMotions[index].reverse(); $("#mainMotionArea" + index).stop().animate({"opacity" : "0"},1000); } //====================µ¿¿µ»ó °ü·Ã=============================== var mainMovieUrlArr = new Array(); var player; var playerReday = false; function setPlayerState(isPlay) { mainVideoPlaying = isPlay; if(isPlay) { $("#motion_player").css("z-index", "999"); } else { $("#motion_player").css("z-index", "99"); } } function playMovie() { if(!playerReday) return; player.playVideo(); setPlayerState(true); } function stopMovie() { if(!playerReday) return; player.stopVideo(); setPlayerState(false); } function pauseMovie() { if(!playerReday) return; player.pauseVideo(); setPlayerState(false); } function muteMovie() { if(!playerReday) return; if(player.isMuted()) player.unMute(); else player.mute(); } function changeMovie(src) { if(!playerReday) return; player.loadVideoById(src, 0, "large"); setPlayerState(true); } var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); function onYouTubeIframeAPIReady() { player = new YT.Player('videoPlayerDiv', { height: '100%', width: '100%', playerVars: { wmode: "transparent" }, videoId: mainMovieUrlArr[0], events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } }); } function onPlayerReady(event){ playerReday = true; } function onPlayerStateChange(event) { switch(event.data) { case -1: //unstarted break; case YT.PlayerState.ENDED: setPlayerState(false); break; case YT.PlayerState.PLAYING: setPlayerState(true); break; case YT.PlayerState.PAUSED: setPlayerState(false); break; case YT.PlayerState.BUFFERING: break; case YT.PlayerState.CUED: break; } } //====================µ¿¿µ»ó °ü·Ã===============================