/*----------------------------------------------- * Scroll Element [フルスクリーン向け横スクロール] -------------------------------------------------*/ /** Lenis[GSAP] **/ const lenis = new Lenis({ orientation: "horizontal", }) let chk_ww = null; let chk_wheelmove = true; let viewChange_chk = false; lenis.on('scroll', (e) => { // console.log(e) // windowSize if(!chk_ww){ // GET WINDOWSIZE[RESET] chk_ww = window.innerWidth; } // スクロール進行状況 let scroll_now = lenis.animatedScroll; let scroll_all = lenis.limit; let scroll_all_calc = scroll_all - chk_ww/2; let scroll_percent = (scroll_now / scroll_all_calc) * 100; if(scroll_percent > 100){ scroll_percent = scroll_percent - 100; }else if(scroll_percent < 0){ scroll_percent = 100 + scroll_percent; } $(".js-scrollPercent").css({'width':scroll_percent + '%'}); let background_persent = scroll_percent * 2; $(".js-fullBg__out").css({'background-position-x':background_persent + '%'}) // console.log('現在のスクロール量:' + scroll_now, '総スクロール量:'+ scroll_all,'現在のスクロール量(%):'+scroll_percent); // BACK TO TOP ACTION let scroll_now_num = Number(scroll_now); let scroll_all_num = Number(scroll_all); if(scroll_now_num > scroll_all_num - chk_ww /2){ let isSP = window.matchMedia('(max-width: 767px)').matches; if(isSP && viewChange_chk){ $("body").addClass('--is-backtotop'); lenis.scrollTo(0,{ duration: 0.1, }); setTimeout(()=>{ $("body").removeClass('--is-backtotop'); }, 500); }else{ lenis.stop(); $("body").css({'overflow':'hidden'}); chk_wheelmove = false; $("body").addClass('--is-backtotop'); $('body,html').animate({scrollLeft:0}, 10, function(){ setTimeout(function(){ $("body").removeClass('--is-backtotop'); $("body").css({'overflow':''}); $(".js-mvImage").css({'object-position':''}); chk_wheelmove = true; document.getElementById('js-fBackTop__img').innerHTML = ':root{--footerImage_tOPersent:0% 50%}'; setTimeout(()=>{ lenis.start(); },500); }, 1500); }); } } }) lenis.on('scroll', ScrollTrigger.update) gsap.ticker.add((time)=>{ lenis.raf(time * 1000) }) gsap.ticker.lagSmoothing(0) /** ScrollElement - horizontal **/ const scrollElement = document.querySelector("html"); // scrollContents scrollElement.addEventListener("wheel", (e) => { if (Math.abs(e.deltaY) < Math.abs(e.deltaX)) return; // console.log(e); const maxScrollLeft = scrollElement.scrollWidth - scrollElement.clientWidth; if ( (scrollElement.scrollLeft <= 0 && e.deltaY < 0) || (scrollElement.scrollLeft >= maxScrollLeft && e.deltaY > 0) ) return; // e.preventDefault(); if(chk_wheelmove){ scrollElement.scrollLeft += e.deltaY; } }); /*----------------------------------------------- * Scroll Navigaiton [現在地の項目をナビゲーションにカレントするやつ] -------------------------------------------------*/ const NAV_ACTIVE_CLASSNAME = 'is-active'; const navlists = document.querySelectorAll('.js-navlink'); const nav_option = { threshold: 0, // rootMargin: '-10px -10px 0% -5%', rootMargin: '-10px -5px 0% 0%', } navlists.forEach(navlist =>{ const nav_target = document.querySelector(navlist.getAttribute('data-nav')); const nav_observer = new IntersectionObserver(([{isIntersecting}]) => { if (isIntersecting) { navlists.forEach(el => el.classList.remove(NAV_ACTIVE_CLASSNAME)); navlist.classList.add(NAV_ACTIVE_CLASSNAME); } },nav_option); nav_observer.observe(nav_target); }) /*----------------------------------------------- * CHARACTER VISUAL -------------------------------------------------*/ const charaVisualWrapper = document.querySelector(".js-charaMv"); let gsap_charaVisual; let mm = gsap.matchMedia(); mm.add("(min-width: 768px)", () => { gsap_charaVisual = gsap.to(".charaVisualLists", { scale: 0.6, scrollTrigger:{ horizontal: true, pin: true, start: () => `${window.innerWidth / 2}`, end: () => `${document.querySelector("#charaVisual").clientWidth + window.innerWidth/2}`, scrub: 1, invalidateOnRefresh: true, onLeaveBack: () => $("body").addClass('--firstview'), onEnter: () => $("body").removeClass('--firstview'), // fastScrollEnd: true, // markers: true } }) }); mm.add("(max-width: 767px)", () => { gsap_charaVisual = gsap.to(".charaVisualLists", { scale: 0.6, scrollTrigger:{ horizontal: true, pin: true, // start: () => `${document.querySelector("#charaVisual").clientWidth - window.innerWidth}`, // start: 0, start: () => `${window.innerWidth / 2}`, end: () => `${document.querySelector("#charaVisual").clientWidth + window.innerWidth/2}`, scrub: 1, invalidateOnRefresh: true, onLeaveBack: () => $("body").addClass('--firstview'), onEnter: () => $("body").removeClass('--firstview'), } }) }); /*----------------------------------------------- * MV -------------------------------------------------*/ const mvWrapper = document.querySelector("#mv"); const mvImage = document.querySelector(".mvImage"); let gsap_mvImageWrap, gsap_mvImageStart; mm.add("(max-width: 767px)", () => { gsap_mvImageStart = gsap.fromTo(".mvImageIn__cont", { scale: 0.6, },{ scale: 1, scrollTrigger:{ horizontal: true, pin: true, // start: () => `${document.querySelector("#charaVisual").clientWidth - window.innerWidth/2}`, start: () => `${window.innerWidth / 2}`, end: () => `${document.querySelector("#charaVisual").clientWidth + window.innerWidth / 2}`, scrub: 1, invalidateOnRefresh: true, } }) gsap_mvImageWrap = gsap.to(".mvImageIn", { scale: 0.6, scrollTrigger:{ horizontal: true,// SP時のみ横スクロール処理 pin: true, start: () => `${document.querySelector("#mv").clientWidth}`, end: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth + window.innerWidth}`, scrub: 1, invalidateOnRefresh: true, onLeaveBack: () => $("body").addClass('--mv'), onEnter: () => $("body").removeClass('--mv'), // onLeave: () => movieBGVideoPlayer('play') } }) }); mm.add("(min-width: 768px)", () => { gsap_mvImageStart = gsap.fromTo(".mvImageIn__cont", { scale: 0.6, },{ scale: 1, scrollTrigger:{ horizontal: true, pin: true, // start: () => `${document.querySelector("#charaVisual").clientWidth - window.innerWidth/2}`, start: () => `${window.innerWidth / 2}`, end: () => `${document.querySelector("#charaVisual").clientWidth + window.innerWidth / 2}`, scrub: 1, invalidateOnRefresh: true, } }) gsap_mvImageWrap = gsap.to(".mvImageIn", { scale: 0.6, scrollTrigger:{ horizontal: true,// SP時のみ横スクロール処理 pin: true, start: () => `${document.querySelector("#mv").clientWidth}`, end: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth + window.innerWidth}`, scrub: 1, invalidateOnRefresh: true, onLeaveBack: () => $("body").addClass('--mv'), onEnter: () => $("body").removeClass('--mv'), onLeave: () => $("body").removeClass('--mv') } }) }); /*----------------------------------------------- * MOVIE -------------------------------------------------*/ let aspect = 16/9; let gsap_movieBG; let gsap_movieBGFin; mm.add("(max-width: 767px)", () => { gsap_movieBG = gsap.fromTo(".movieBgIn",{ scale: 0.6, },{ scale:1, scrollTrigger:{ horizontal: true, pin: true, // start: () => `${document.querySelector("#mv").clientWidth}`, // mvが終わったら開始 //start: () => `${document.querySelector("#charaVisual").clientWidth - window.innerWidth/2}`, //charaVisualが終わったら開始 //end: () => `${document.querySelector("#charaVisual").clientWidth + window.innerWidth}`, start: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth - window.innerWidth/2}`, // mvが終わったら開始 end: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth + window.innerWidth}`, scrub: 1, invalidateOnRefresh: true, onLeaveBack: () => movieBGAction('onLeaveBack'), onEnter: () => movieBGAction('onEnter'), onLeave: () => movieBGAction('onLeave'), onEnterBack: () => movieBGAction('onEnterBack'), onUpdate: self => { // var progress = Math.floor(self.progress * 100) / 100; var progress = self.progress; movieScrollSP('start',progress); } } }) gsap_movieBGFin = gsap.fromTo(".movieBgInOut",{ scale: 1, },{ scale: 0.6, scrollTrigger:{ horizontal: true, pin: true, //start: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector(".topContentsIn").clientWidth - window.innerWidth*1.35}`, //end: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector(".topContentsIn").clientWidth - window.innerWidth/4}`, start: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth + document.querySelector(".topContentsIn").clientWidth - window.innerWidth*1.35}`, end: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth + document.querySelector(".topContentsIn").clientWidth - window.innerWidth/4}`, scrub: 1, invalidateOnRefresh: true, // onLeaveBack: () => console.log('FIN => onLeaveBack_sp'), // onEnter: () => console.log('FIN => onLeaveBack_sp'), // onLeave: () => console.log('FIN => onLeaveBack_sp'), // onEnterBack: () => console.log('FIN => onLeaveBack_sp'), onUpdate: self => { var progress = self.progress; movieScrollSP('end',progress); // console.log('sp'); } } }) }); function movieScrollSP(_mode,_progrss){ // ビデオ要素の計算 let movBGVideoWidth = document.querySelector(".js-movieBgVideo").clientWidth; let calc_harf__movBGVideoWidth = movBGVideoWidth/2; // windowSize let harf_wiw = window.innerWidth/2; // 計算する let calc_maxVideoWidth = calc_harf__movBGVideoWidth - harf_wiw; let calc_progressVideoWidth = calc_maxVideoWidth * _progrss; if(_mode == 'start'){ let calc_cssVideoWidth = calc_maxVideoWidth - calc_progressVideoWidth; $(".js-movieBgVideo").css({'left':calc_cssVideoWidth + 'px'}); }else if(_mode == 'end'){ $(".js-movieBgVideo").css({'left':'-' + calc_progressVideoWidth + 'px'}); } } mm.add("(min-width: 768px)", () => { gsap_movieBG = gsap.fromTo(".movieBgIn",{ scale: 0.6, },{ scale:1, scrollTrigger:{ horizontal: true, pin: true, //start: () => `${document.querySelector("#charaVisual").clientWidth - window.innerWidth/2}`, //end: () => `${document.querySelector("#charaVisual").clientWidth + window.innerWidth / 2}`, start: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth - window.innerWidth/2}`, end: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth + window.innerWidth / 2}`, scrub: 1, // markers: true, invalidateOnRefresh: true, onLeaveBack: () => movieBGAction('onLeaveBack'), onEnter: () => movieBGAction('onEnter'), onLeave: () => movieBGAction('onLeave'), onEnterBack: () => movieBGAction('onEnterBack') } }) gsap_movieBGFin = gsap.fromTo(".movieBgInOut",{ scale: 1, },{ scale: 0.6, scrollTrigger:{ horizontal: true, pin: true, //start: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector(".topContentsIn").clientWidth - window.innerWidth*1.5}`, //end: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector(".topContentsIn").clientWidth - window.innerWidth/4}`, start: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth + document.querySelector(".topContentsIn").clientWidth - window.innerWidth*1.5}`, end: () => `${document.querySelector("#charaVisual").clientWidth + document.querySelector("#mv").clientWidth + document.querySelector(".topContentsIn").clientWidth - window.innerWidth/4}`, scrub: 1, invalidateOnRefresh: true, // onLeaveBack: () => console.log('FIN => onLeaveBack'), // onEnter: () => console.log('FIN => onLeaveBack'), // onLeave: () => console.log('FIN => onLeaveBack'), // onEnterBack: () => console.log('FIN => onLeaveBack') } }) }); // MOVIE ASPECT function moviebg_size(){ let wiw = window.innerWidth; wih = window.innerHeight; minww = wiw; minwh = wih; mw = wiw / 2; mh = wih; if(mw <= wiw){ mw = minww; } if(mh <= minwh){ mh = minwh; } // BG SIZE if(mw/mh <= aspect){ $(".js-movieBg__cont").css({"height":mh+"px","width":mh*aspect+"px"}); }else{ $(".js-movieBg__cont").css({"height":mw/aspect+"px","width":mw+"px"}); } // MIN let p_movFrame__width = wiw * 0.711667; let p_movFrame__height = wih * 0.75; if(wiw > 768){ // PC if(p_movFrame__width / p_movFrame__height > aspect){ // PC - Horizontal $(".js-movieBgIn").css({ 'min-height': p_movFrame__height + 'px', 'min-width': p_movFrame__height * aspect + 'px' }); }else{ // PC - Vertical $(".js-movieBgIn").css({ 'min-height': p_movFrame__width / aspect + 'px', 'min-width': p_movFrame__width + 'px' }) } } } // MOVIEBG ACTION function movieBGAction(_config){ if(_config == 'onLeaveBack'){ $("#movie").removeClass('--show'); $("body").removeClass('--movieShow'); }else if(_config == 'onEnter'){ $("#movie").removeClass('--show'); $("body").removeClass('--movieShow'); }else if(_config == 'onLeave'){ $("#movie").addClass('--show'); $("body").addClass('--movieShow'); }else if(_config == 'onEnterBack'){ $("#movie").removeClass('--show'); $("body").addClass('--movieShow'); } } /*----------------------------------------------- * TOP CONTENS -------------------------------------------------*/ /* contents */ const scr_topContent = () =>{ const SCRANI_tc_ACTIVE_CLASSNAME = '--is-view-content'; const scrani_tc_callback = (entries) => { entries.forEach( (entry) => { if (entry.isIntersecting) { entry.target.classList.add(SCRANI_tc_ACTIVE_CLASSNAME); $(".js-movieBg__cont").addClass('--contentIn'); }else{ entry.target.classList.remove(SCRANI_tc_ACTIVE_CLASSNAME); $(".js-movieBg__cont").removeClass('--contentIn'); } }); } const scrani_tc_option = { rootMargin: '0% -100% 0% -100%', } const scrani_tc_observer = new IntersectionObserver(scrani_tc_callback, scrani_tc_option); const target_tc_scrani = document.querySelectorAll('.js-topContentsBg'); target_tc_scrani.forEach( (elem) => { scrani_tc_observer.observe(elem); }); } scr_topContent(); /* contentIn */ const scr_topContentIn = () =>{ const SCRANI_tcIn_ACTIVE_CLASSNAME = '--is-view'; const scrani_tcIn_callback = (entries) => { entries.forEach( (entry) => { if (entry.isIntersecting) { entry.target.classList.add(SCRANI_tcIn_ACTIVE_CLASSNAME); }else{ entry.target.classList.remove(SCRANI_tcIn_ACTIVE_CLASSNAME); } }); } const scrani_tcIn_option = { rootMargin: '0% -25% 0% 0%', } const scrani_tcIn_observer = new IntersectionObserver(scrani_tcIn_callback, scrani_tcIn_option); const target_tcIn_scrani = document.querySelectorAll('.js-topContentIn'); target_tcIn_scrani.forEach( (elem) => { scrani_tcIn_observer.observe(elem); }); } scr_topContentIn(); /*----------------------------------------------- * FOOTER VISUAL -------------------------------------------------*/ let gsap_footerImageWrap; // mm.add("(max-width: 767px)", () => { // gsap_footerImageWrap = gsap.to(".fBackTop__img", { // scale: 1, // scrollTrigger:{ // horizontal: true,// SP時のみ横スクロール処理 // pin: true, // start: () => `${document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".s-fpdr").clientWidth + document.querySelector(".tFooterIn").clientWidth - window.innerWidth/4}`, // end: () => `${document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".s-fpdr").clientWidth + document.querySelector(".tFooterIn").clientWidth + window.innerWidth / 2}`, // scrub: 1, // invalidateOnRefresh: true, // // onLeaveBack: () => { // // console.log('footerImage => onLeaveBack'); // // }, // // onEnter: () => console.log('footerImage => onEnter'), // // onLeave: () => console.log('footerImage => onLeave'), // } // }) // }) // mm.add("(min-width: 768px)", () => { // gsap_footerImageWrap = gsap.to(".fBackTop__img", { // scale: 1, // scrollTrigger:{ // horizontal: true,// SP時のみ横スクロール処理 // pin: true, // start: () => `${document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".tFooterIn").clientWidth/5}`, // end: () => `${document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".tFooterIn").clientWidth}`, // scrub: 1, // invalidateOnRefresh: true, // // onLeaveBack: () => { // // console.log('footerImage => onLeaveBack'); // // }, // // onEnter: () => console.log('footerImage => onEnter'), // // onLeave: () => console.log('footerImage => onLeave'), // // onUpdate:()=>{ // // footerImage_scr(); // // } // } // }) // }) function footerImage_scr(){ let footerImage_statPossition = document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".tFooterIn").clientWidth/2; let footerImage_endPossition = document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".tFooterIn").clientWidth; let footerImage_scrollNow = lenis.animatedScroll; let set_footerImage_scrollNow = footerImage_scrollNow - footerImage_statPossition; let set_footerImage_endPossition = footerImage_endPossition - footerImage_statPossition; let footerImage_tOPersent = (set_footerImage_scrollNow / set_footerImage_endPossition) * 50; if(footerImage_tOPersent > 50){ footerImage_tOPersent = 50; }else if(footerImage_tOPersent < 0){ footerImage_tOPersent = 0; } document.getElementById('js-fBackTop__img').innerHTML = ':root{--footerImage_tOPersent:'+ footerImage_tOPersent + '% 50%}'; } /*----------------------------------------------- * FOOTER CHARACTERVISUAL -------------------------------------------------*/ let gsap_footercVisualWrap; mm.add("(max-width: 767px)", () => { gsap_footercVisualWrap = gsap.to(".js-fBackTop__cVisual", { scale: 1, scrollTrigger:{ horizontal: true,// SP時のみ横スクロール処理 pin: true, start: () => `${document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".s-fpdr").clientWidth + document.querySelector(".tFooterIn").clientWidth - window.innerWidth/4}`, end: () => `${document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".s-fpdr").clientWidth + document.querySelector(".tFooterIn").clientWidth + window.innerWidth / 2}`, scrub: 1, invalidateOnRefresh: true, // onLeaveBack: () => { // console.log('footerImage => onLeaveBack'); // }, // onEnter: () => console.log('footerImage => onEnter'), // onLeave: () => console.log('footerImage => onLeave'), } }) }) mm.add("(min-width: 768px)", () => { gsap_footercVisualWrap = gsap.to(".js-fBackTop__cVisual", { scale: 1, scrollTrigger:{ horizontal: true,// SP時のみ横スクロール処理 pin: true, start: () => `${document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".tFooterIn").clientWidth/5}`, end: () => `${document.querySelector(".scrollElementMain").clientWidth + document.querySelector(".tFooterIn").clientWidth}`, scrub: 1, invalidateOnRefresh: true, // onLeaveBack: () => { // console.log('footerImage => onLeaveBack'); // }, // onEnter: () => console.log('footerImage => onEnter'), // onLeave: () => console.log('footerImage => onLeave'), // onUpdate:()=>{ // footerImage_scr(); // } } }) }) /*----------------------------------------------- * SP: ASPECT -------------------------------------------------*/ /** * GET ASPECT */ let xap = null; let yap = null; function getAspect(){ let wiw = window.innerWidth; let wih = window.innerHeight; let wap = wiw - 0; let hap = wih - 0; let g = gcd(wap, hap); xap = wiw / g; yap = wih / g; } /** * 最大公約数[GCD] */ function gcd(x, y) { if (y === 0) return x; return gcd(y, x % y); } function spAspect(){ if(window.matchMedia('(max-width: 767px)').matches){ getAspect(); let as_calc = xap/yap; // INTRODUCTION - TEXT ASPECT if(as_calc > 0.8503401){ $(".js-s_introAspect").attr('data-width','collum6'); }else if(as_calc > 0.7878151){ $(".js-s_introAspect").attr('data-width','collum5'); }else if(as_calc > 0.74400476){ $(".js-s_introAspect").attr('data-width','collum4'); }else if(as_calc > 0.54545){ $(".js-s_introAspect").attr('data-width','collum3'); }else{ $(".js-s_introAspect").attr('data-width','collum2'); } // PROLOGUE - TEST ASPECT if(as_calc > 0.998666){ $(".js-s_prologueAspect").attr('data-width','collum4'); }else if(as_calc > 0.6880733){ $(".js-s_prologueAspect").attr('data-width','collum3'); }else if(as_calc > 0.4609711){ $(".js-s_prologueAspect").attr('data-width','collum2'); }else{ $(".js-s_prologueAspect").attr('data-width','collum1'); } // console.log(xap,yap); } } /*----------------------------------------------- * COMMON ACTION -------------------------------------------------*/ let wiw_com = window.innerWidth; let wih_com = window.innerHeight; // resizeEVENT function resize(){ // RESET LET chk_ww = null; wiw_com = window.innerWidth; wih_com = window.innerHeight; // CharacterVisual gsap_charaVisual.scrollTrigger.refresh(); // MV gsap_mvImageStart.scrollTrigger.refresh(); gsap_mvImageWrap.scrollTrigger.refresh(); // MOVIE gsap_movieBG.scrollTrigger.refresh(); gsap_movieBGFin.scrollTrigger.refresh(); moviebg_size(); lenis.resize(); // FOOTER // gsap_footerImageWrap.scrollTrigger.refresh(); // SP ASPECT spAspect(); // PC CHARACTER resizeCharacterPC(); } window.addEventListener('resize', resize); function load(){ resize(); // moviebg_size(); // spAspect(); // resizeCharacterPC(); } window.addEventListener('load', load); /*----------------------------------------------- * COMMON ACTION -------------------------------------------------*/ function backToTop_btn(){ // GET WINDOWSIZE[RESET] chk_ww = window.innerWidth; let page_end = lenis.limit - chk_ww/2 + 100; lenis.scrollTo(page_end,{ duration: 2.4, }); } /*----------------------------------------------- * LOADING -------------------------------------------------*/ lenis.stop(); $("body").css({'overflow':'hidden'}); $(window).on('load',function(){ var hs = location.hash; if(!hs){ $('body,html').animate({scrollLeft: 0}, 10, 'easeOutQuart'); }else if(hs == '#movie'){ var ww = window.innerWidth; var position = $("#movie").offset().left + ww/2 + 200; $('body,html').animate({scrollLeft: position}, 10, 'easeOutQuart'); } let mmSp = window.matchMedia('(max-width: 767px)') setTimeout(function(){ $("body").addClass('--is-load'); setTimeout(function(){ $("#loading").fadeOut(600); setTimeout(function(){ if(mmSp.matches){ // if(!hs){ // setTimeout(()=>{ // let sp_loaded_scorllleft = document.querySelector(".mvImage").clientWidth / 4; // $('body,html').animate({scrollLeft: sp_loaded_scorllleft}, 800, 'easeOutQuart', function(){ // $("body").addClass('--is-loaded'); // lenis.start(); // $("body").css({'overflow':''}); // set_scrani(); // sScrollGuide_loaded(); // movieBGVideoPlayer('play'); // }) // }, 300); // }else{ $("body").addClass('--is-loaded'); lenis.start(); $("body").css({'overflow':''}); set_scrani(); sScrollGuide_loaded(); movieBGVideoPlayer('play'); // } }else{ $("body").addClass('--is-loaded'); lenis.start(); $("body").css({'overflow':''}); set_scrani(); movieBGVideoPlayer('play'); } },200); },600); },800); }); function sScrollGuide_loaded(){ $("#s-scrollguide").addClass('-is-loaded'); setTimeout(()=>{ $("#s-scrollguide").fadeOut(800); },800);/* 1600 */ } /*----------------------------------------------- * POINTER -------------------------------------------------*/ $(function(){ /** * Cursor */ var fullCursor = $(".cursor"); var fullCursor_in = $(".js-cursor__in"); var fullCursor_out = $(".js-cursor__out"); var cWidthFull = 96; var delay_in = 5; var delay_out = 10; var mouseXFull = 0; var mouseYFull = 0; // var posXFull = 0; // var posYFull = 0; var posXFull_in = 0; var posYFull_in = 0; var posXFull_out = 0; var posYFull_out = 0; TweenMax.to({}, .001, { repeat: -1, onRepeat: function() { posXFull_in += (mouseXFull - posXFull_in) / delay_in; posYFull_in += (mouseYFull - posYFull_in) / delay_in; posXFull_out += (mouseXFull - posXFull_out) / delay_out; posYFull_out += (mouseYFull - posYFull_out) / delay_out; TweenMax.set(fullCursor_in, { css: { left: posXFull_in - (cWidthFull / 2), top: posYFull_in - (cWidthFull / 2) } }); TweenMax.set(fullCursor_out, { css: { left: posXFull_out - (cWidthFull / 2), top: posYFull_out - (cWidthFull / 2) } }); } }); $(document).on("mousemove", function(e) { mouseXFull = e.clientX; mouseYFull = e.clientY; }); // top setTimeout(function () { $(".js-btn_moviePlay").on({ "mouseenter": function () { fullCursor.addClass("is-hover"); }, "mouseleave": function () { fullCursor.removeClass("is-hover"); } }); }, 3000); }); function visualMouseover(){ let targetClassName = document.querySelector(".js-mv_mouseOver"); var topMainW = targetClassName.clientWidth; var topMainH = targetClassName.clientHeight; $(".js-mv_mouseOver").on({ 'mousemove': function(e) { var mouseAreaX = e.offsetX; var mouseAreaY = e.offsetY; var mXp1 = mouseAreaX / topMainW; var mYp1 = mouseAreaY / topMainH; var mXp1 = mXp1 * 100; var mXp1 = mXp1 * 1.05; var mXp1 = Math.round(mXp1); var mYp1 = mYp1 * 100; var mYp1 = mYp1 * 1.05; var mYp1 = Math.round(mYp1); if (mXp1 > 100) mXp1 = 100; if (mYp1 > 100) mYp1 = 100; gsap.to(".js-mvImage",{ // ease: Power2.easeOut, // ease: CustomEase.create("custom", "0.104,0.204,0.492,1"), // duration: 2, objectPosition: mXp1 + "% " + mYp1 + "%" }); }, 'mouseenter': function () { }, 'mouseleave': function () { } }); } visualMouseover(); function charaVisualMouseover(){ $(".js-charaVisual_mouseOver").on({ 'mousemove': function(e) { let CVtargetClassName = document.querySelector(".js-charaVisual_mouseOver"); let CVClassName = document.querySelector(".charaVisual__contInWrap"); var cvMainW = CVtargetClassName.clientWidth; var cvMainH = CVtargetClassName.clientHeight; var cvWidth = CVClassName.clientWidth; var cvHeight = CVClassName.clientHeight; var mouseAreaX = e.offsetX; var mouseAreaY = e.offsetY; var mX = cvMainW - cvWidth + (mouseAreaX / 2); if(mX > 0){ mX = 0; } // var mXp1 = mouseAreaX / cvMainW; // var mYp1 = mouseAreaY / cvMainH; // var mXp1 = mXp1 * 100; // var mXp1 = mXp1 * 1.05; // var mXp1 = Math.round(mXp1); // var mYp1 = mYp1 * 100; // var mYp1 = mYp1 * 1.05; // var mYp1 = Math.round(mYp1); // if (mXp1 > 100) // mXp1 = 100; // if (mYp1 > 100) // mYp1 = 100; console.log(mouseAreaX,mouseAreaY,cvMainW,cvMainH,cvWidth,cvHeight); gsap.to(".js-charaMv",{ // ease: Power2.easeOut, // ease: CustomEase.create("custom", "0.104,0.204,0.492,1"), // duration: 2, // x: mXp1 + "%", // y: mYp1 + "%" x: mX }); }, 'mouseenter': function () { }, 'mouseleave': function () { } }); } // charaVisualMouseover(); /*----------------------------------------------- * SWITCH RELOAD RESIZE [PC <-> SP] -------------------------------------------------*/ $(function(){ var pcD = '_pc.'; var spD = '_sp.'; var bp = 768; var ww = window.innerWidth; var loadP = (bp < ww) ? pcD : spD, viewP; $(window).on("resize", function(){ ww = window.innerWidth; viewP = (bp < ww) ? pcD : spD; if (loadP != viewP) { setTimeout("window.location.reload()", 1); } }); }) /*----------------------------------------------- * TOP:NEXT SECTION -------------------------------------------------*/ $(".js-btn_nextsection").on('click', ()=>{ $(".btn_nextsection").css({'pointer-events':'none'}); setTimeout(()=>{ let now_href,now_href_no,next_href,next_href_no,_section; let maxi = 8; // 最大メニュー数 $(".js-navlink").each(function(i,v){ i++; now_href_no = i; now_href = $(this).attr('href'); if($(this).hasClass('is-active')){ next_href_no = i + 1; // console.log('next->'+ next_href_no); } if(next_href_no > maxi){ console.log(next_href_no,'一番後ろ'); _section = 'end'; }else if(now_href_no == next_href_no){ next_href = $(this).attr('href'); // console.log(next_href); _section = next_href; } // console.log(now_href_no, now_href); }); console.log(_section); if(_section != 'end'){ var speed = 1000; var target = $(_section); var position = target.offset().left; if(_section == '#movie'){ var ww = window.innerWidth; position = target.offset().left + ww/2 + 200; } $('body,html').animate({scrollLeft:position}, speed, 'easeOutQuart'); }else{ backToTop_btn(); } setTimeout(()=>{ $(".btn_nextsection").css({'pointer-events':''}); },1000); },10); return false; }); /*----------------------------------------------- * CHARACTER -------------------------------------------------*/ function resizeCharacterPC(){ var _characterCont = document.querySelector('.js-characterContIn'); if(window.matchMedia('(min-width: 768px) and (max-height: 729px)').matches){ _characterCont.setAttribute('data-lenis-prevent', ''); }else{ _characterCont.removeAttribute('data-lenis-prevent'); } } /* CHARACTER SWIPER */ let charaBGVideo; function characterSwiper(){ let characterSwiper; console.log($(".charaDetailLists li").length); if($(".charaDetailLists li").length > 1){ characterSwiper = new Swiper('.js-charaDetailSwiper', { slidesPerView: 1, effect: "fade", allowTouchMove: false, fadeEffect: { crossFade: true }, pagination: { el: '.js-charaSwiperSelectLists', clickable: true, renderBullet: function (index, className) { var charaNum = index+1; return '