ç¹å®ã®ã¹ã¯ããŒã«ã¡ã«ããºã ãå®è£ ããããã®ãã¯ãããž
CSSã«ã¯ãææ°ã®ãã©ãŠã¶ãŒã§ãµããŒããããŠããåçŽãªæšæºã¹ã¯ããŒã«å¹æãããã€ããããŸããå Žåã«ãã£ãŠã¯ããããã®ã¢ããªã±ãŒã·ã§ã³ã¯ãããžã§ã¯ãã®ç¹å®ã®ããŒãºãæºããã®ã«ååãããããŸããã
âCSSããããã£ã®äœçœ®ïŒã¹ãã£ãããŒ
æ®ãã®ããŒãžã³ã³ãã³ããšäžç·ã«ã¹ã¯ããŒã«ããªãèŠçŽ ãå¿ èŠãªå Žåã¯ããã®èŠçŽ ã®ã¹ã¿ã€ã«ãèšå®ãããšãã«ãããããã£ãé©çšããã ãã§åå
position: sticky
ã§ããããã¯ã·ã³ãã«ã§åçŽãªããªãã¯ã§ããããã®ãµããŒãã¯ææ°ã®ãã©ãŠã¶ãŒã«çµã¿èŸŒãŸããŠããŸãããããããããIEãäžéšã®ã¢ãã€ã«ãã©ãŠã¶ãŒã§æ©èœãããã«ã¯ãããªãã£ã«ãå¿
èŠã§ãããã®ãããã¯ã«èå³ãããå Žåã¯ããã®è³æãã芧ãã ããã
éãèŠçŽ ã¯ã³ã³ããã®äžéšã«ãæ®ãããä»ã®èŠçŽ ãšäžç·ã«ã¹ã¯ããŒã«ããŸããã
ãã®ãããªã¹ã¯ããŒã«ã®äŸã次ã«ç€ºããŸãã
âèŠå·®å¹æ
èŠå·®å¹æã¯ããããç¹å¥ãªæè¡ã§ã¯ãªããç¹å¥ãªæè¡ã§ãããã ãããã®å¹æã¯ãã¹ã¯ããŒã«æã«ããŒãžã®ããŸããŸãªéšåãããŸããŸãªé床ã§ç§»åããå¿ èŠãããå Žåã«ãéåžžã«åœ¹ç«ã¡ãŸãããã®ãã¯ããã¯ã¯ããã®è³æã§è©³ãã説æãããŠããŸãããã®å®è£ ã®å€ãã®äŸããããŸããããšãã°ããããç§ã«ãšã£ãŠããã®ææ³ã®äž»ãªæ¬ ç¹ã¯ãæ£ããèŠå·®å¹æãäžããã©ã®å€ã䜿çšããŠããŒã¹ãã¯ãã£ããšå€æãèšå®ããããç解ããããšãé£ããããšã§ãã
èŠå·®å¹æïŒèŠçŽ ã¯ç°ãªãé床ã§ç§»åããŸãã
ãããèŠå·®å¹æã®ãã¢ã§ãã
specificç¹å®ã®ãã€ã³ããŸã§ã¹ã¯ããŒã«
ã¢ã³ã«ãŒãã€ã³ãã§ã¹ã¯ããŒã«ã䜿çšãããšããŠãŒã¶ãŒãéåžžã®ã¹ã¯ããŒã«æäœãå®äºããåŸã§ããã©ãŠã¶ãŒãèŠçŽ ãç¹å®ã®äœçœ®ã«ç§»åããããšã§ãèŠçŽ ã®äœçœ®ãèªåçã«èª¿æŽã§ããŸããããã¯ãã¹ã¯ããŒã«ã®çµäºåŸãç¹å®ã®èŠçŽ ãå®å šã«ãŠãŒã¶ãŒã®èŠéã«å ¥ãå¿ èŠãããå Žåã«åœ¹ç«ã¡ãŸãããã ããAPIã¯ãŸã äžå®å®ã§ãããããææ°ã®å®è£ ã䜿çšããŠãæ¬çªç°å¢ã§ã®ã¹ã¯ããŒã«ã«ãã®ã¢ãããŒãã䜿çšããå Žåã¯æ³šæããŠãã ãããããã¯ããã®ä»¶ã«é¢ããåªããèšäºã§ãã
ãŠãŒã¶ãã³ã³ãã³ããã¹ã¯ããŒã«ããŠãã³ã³ããã®äžéšããŒããŒãªãèŠçŽ ã移åããå Žåãããã¯ãã®å šäœãèŠããããã«ããã©ãŠã¶ãèªåçã«èŠçŽ ãåé 眮ããŸãã
ããã§ã¢ã³ã«ãŒãã€ã³ããæã€äœåãã¹ã¯ããŒã«ããæ¹æ³ã®ãã¢ãã
âã¹ã ãŒãºãªã¹ã¯ããŒã«
JavaScriptã§window.scrollToïŒïŒ ã¡ãœããã䜿çšããŠããŸãã¯scroll-behavior CSSããããã£ã䜿çšããŠããŒãžãç¹å®ã®ã»ã¯ã·ã§ã³ã«ã¹ã¯ããŒã«ããå Žåããã©ãŠã¶ããŒã«ã¯ã¹ã ãŒãºã¹ã¯ããŒã«ããµããŒãããŠããŸããçŸåšãããŠã¹ãã€ãŒã«ã®åããã¹ã ãŒãºã«ããŠã¹ã ãŒãºã¹ã¯ããŒã«ãå®è£ ããã«ã¯ãç¹å¥ãªJavaScriptã©ã€ãã©ãªãå¿ èŠã§ãããã ãããã®ãããªã©ã€ãã©ãªã䜿çšããå Žåã¯ãä»ã®ã¹ã¯ããŒã«ãã¯ãããžãšã®éåžžã®çžäºäœçšãä¿èšŒããå¿ èŠããããŸããããã«ãã¹ã ãŒãºã¹ã¯ããŒã«ã䜿çšããããšã¯å¿ ãããè¯ãèãã§ã¯ãããŸããã
äžè¬çãªã¹ã¯ããŒã«æè¡
çŸåšãã¹ã¯ããŒã«äœçœ®ã«åºã¥ããŠæ±çšã®ã¹ã¯ããŒã«ã¢ãã¡ãŒã·ã§ã³ãããªã¬ãŒããCSSå°çšã®æ¹æ³ã¯ãããŸããïŒå°æ¥çã«ã¯ãããã€ãã®æ±çšã®ã¹ã¯ããŒã«ã¢ãã¡ãŒã·ã§ã³ãèªç±ã«äœ¿ããããã«ãããšããææ¡ããããŸãïŒ ããã®çµæãã¹ã¯ããŒã«ããªããèŠçŽ ãã¢ãã¡ãŒã·ã§ã³åãããå Žåãå°ãªããšãããã€ãã®JavaScriptã³ãŒãã䜿çšããŠãç®çã®å¹æãåŸãå¿ èŠããããŸããJavaScriptã䜿çšããŠèŠçŽ ãã¹ã¯ããŒã«ããªããã¢ãã¡ãŒã·ã§ã³åããã«ã¯ã2ã€ã®æ¹æ³ããããŸãã1ã€ç®ã¯Intersection Observer APIã䜿çšããããšã2ã€ç®ã¯ã€ãã³ããåŠçããããš
scroll
ã§ãã
the亀差ãªãã¶ãŒããŒAPIã®äœ¿çš
IntersectionObserver APIã䜿çšãããšãã¢ãã¡ãŒã·ã§ã³ãéå§ããããã«å¿ èŠãªã®ããèŠçŽ ããã¥ãŒããŒãã«è¡šç€ºãããŠãããã©ãããããã³èŠçŽ ã®ã©ã®éšåã衚瀺ãããŠããããç¥ã£ãŠããå Žåãã¹ã¯ããŒã«ã«é¢é£ããããŸããŸãªã¿ã¹ã¯ãæ£åžžã«è§£æ±ºã§ããŸãã ãããã«ãããIntersectionObserver APIã¯ãç»é¢äžã®èŠçŽ ã®å€èŠ³ã«äŒŽãã¢ãã¡ãŒã·ã§ã³ãèµ·åããããã®åªããããŒã«ã«ãªããŸããããããããã§ãããã®APIã䜿çšããŠå®è£ ããããšã¯ïŒå¯èœã§ããïŒéåžžã«å°é£ãªå¹æããããŸããããšãã°ãèŠçŽ ã®ç§»åæ¹åã«å¿ããŠãããŸããŸãªã¢ãã¡ãŒã·ã§ã³ãèµ·åããŸããããã«ããã®APIã¯ãã¹ã¯ããŒã«æã«ãèŠçŽ ããã¥ãŒããŒãã®äžå€®ã«ãããšãã«ã¢ãã¡ãŒã·ã§ã³ãéå§ããå¿ èŠãããå Žåãã€ãŸãããã¥ãŒããŒãã«èŠçŽ ã衚瀺ãããªãããŸãã¯èŠçŽ ã衚瀺ãããªãå Žåã«ã¯ãç¹ã«åœ¹ç«ã¡ãŸããã
thescrollã€ãã³ãã®äœ¿çš
ã¹ã¯ããŒã«äžã®ã¢ãã¡ãŒã·ã§ã³ã®å®è£ ã«ã€ãã³ãã䜿çšãã人ã«ãšã£ãŠã
scroll
éåžžã«å€§ããªãã£ã³ã¹ããããŸãããã®ææ³ã䜿çšãããšãã¹ã¯ããŒã«æã«ããã¥ãŒããŒãã®å¢çç·ãåºæºã«ããŠèŠçŽ ã®ä»»æã®äœçœ®ã«ããèŠçŽ ã«åœ±é¿ãäžããããšãã§ããŸããã€ãã³ãã䜿çšscroll
ãããšããããžã§ã¯ãã®ããŒãºã«å¿ããŠãã¢ãã¡ãŒã·ã§ã³ã®éå§ãšçµäºã®äœçœ®ãéåžžã«æ£ç¢ºã«èšå®ã§ããŸãã
ãã®ãããã¢ãã¡ãŒã·ã§ã³ãã¹ã¯ããŒã«ãããã®ã¢ãããŒãã¯ãã·ã¹ãã ã«å€§ããªè² è·ããããå¯èœæ§ãããããšã«æ³šæããŠãã ãããããã¯ãéçºè ãããã©ãŒãã³ã¹ãæ°ã«ãããã€ãã³ãåŠçã®é »åºŠãå¶éããªãå Žåã«çºçããŸã
scroll
ãããã«ãã€ãã³ãã䜿çšããããšã«æ±ºããããã°ã©ããŒã®åŠåã§scroll
ãããŸããŸãªã¹ã¯ããŒã«ã·ããªãªãå®è£
ã§ãã䟿å©ãªAPIã¯ãããŸããããã®ãããå€ãã®å Žåãã€ãã³ãåŠçã¡ã«ããºã ãscroll
ç¬èªã«å®è£
ãã代ããã«ãäœæè
ãã€ãã³ãåŠçscroll
ãããã©ãŒãã³ã¹ãšAPI ã®äž¡æ¹ã«äžãã圱é¿ããã§ã«åŠçããŠããå°çšã©ã€ãã©ãªã䜿çšããããšãçã«ããªã£ãŠããŸãããããã®ã©ã€ãã©ãªã®äžéšã¯ãèŠçŽ ã®ãµã€ãºã«åé¡ãããå Žåã«éçºè
ãæ¯æŽããããšããã§ããŸãã
æ±çšã¹ã¯ããŒã«ããŒã«
éçºè ãããŒãžãã¹ã¯ããŒã«ãããšãã«å®è¡ãããã¢ãã¡ãŒã·ã§ã³ãå®å šã«å¶åŸ¡ã§ããããã«ããéçºè ãèªåã§è€éãªèšç®ãããã«ã§ããã ãç°¡åã«ç掻ã§ããããã«ããããšãç®çãšãã匷åãªã¹ã¯ããŒã«ã©ã€ãã©ãªãããã€ããããŸãã
âScrollMagic
ScrollMagic ã©ã€ãã©ãªã¯ãããŸããŸãªã¹ã¯ããŒã«å¹æãäœæã§ããæ¯èŒçã·ã³ãã«ãªAPIãæäŸããŸãããã®ã©ã€ãã©ãªã¯ãGSAPãVelocity.jsãªã©ã®ããŸããŸãªã¢ãã¡ãŒã·ã§ã³ã©ã€ãã©ãªãšé£æºã§ããŸãã確ãã«ãããæ°å¹Žããã®ã©ã€ãã©ãªã¯ååã«ãµããŒããããŠããŸãããããã«ãããScrollSceneã©ã€ãã©ãªãäœæãããŸããã
âScrollScene
ScrollSceneã¯ãæ¬è³ªçã«ã¯ãScrollMagicã©ã€ãã©ãªãIntersectionObserver APIã®äœ¿ãããããåäžãããããšãç®çãšããã©ãããŒã§ããç¬èªã®ããŒãžã§ã³ã®ScrollMagicã䜿çšããŠãããéåžžã®ã©ã€ãã©ãªããããµããŒããåªããŠããŸãããããªã®åçãã¢ãã¡ãŒã·ã§ã³ã«åœ±é¿ãäžãããã¬ãŒã¯ãã€ã³ãã®ãµããŒããªã©ãããã«ã¯è¿œå ã®æ©èœããããŸãããŸãããã®ã©ã€ãã©ãªã¯GSAPã䜿çšããŠããŸãã
âScrollTrigger
ScrollTrigger ã©ã€ãã©ãªã¯ãGSAPã®å ¬åŒGreenSockãã©ã°ã€ã³ã§ãããã®ã©ã€ãã©ãªã«ã¯å€æ°ã®æ©èœãããããã®APIã¯æ¢åã®ã¹ã¯ããŒã«ã©ã€ãã©ãªã®æãåçŽãªAPIã®ããã§ãããã®ã©ã€ãã©ãªã䜿çšãããšãã¹ã¯ããŒã«ã¢ãã¡ãŒã·ã§ã³ã®éå§äœçœ®ãšçµäºäœçœ®ãå®å šã«å¶åŸ¡ã§ããã¹ã¯ããŒã«äžã«å¿ èŠãªãã®ïŒWebGLããã£ã³ãã¹ãSVGãDOMïŒãã¢ãã¡ãŒã·ã§ã³åã§ããã¢ãã¡ãŒã·ã§ã³ã®å®è¡äžã«èŠçŽ ãåºå®ã§ããŸãããã®ã©ã€ãã©ãªã®æ©èœã¯ããã«éå®ãããŸãããããã«ãGreenSockã¯ãã®ã©ã€ãã©ãªããµããŒãããŠããŸããGreenSock ãã©ãŒã©ã ã§ã©ã€ãã©ãªã®äœ¿çšã«é¢ãããã«ããå ¥æã§ããŸãã
â泚ç®ã®ã©ã€ãã©ãªïŒæ©é¢è»ã¹ã¯ããŒã«
Locomotive Scroll ã©ã€ãã©ãªãŒã¯ããããŸã§ã«èª¬æããä»ã®ã©ã€ãã©ãªãŒã»ã©å¹ åºãæ©èœã»ãããæäŸããããšã¯ããŠããŸããããã®äž»ãªç®æšã¯ãã¹ã ãŒãºãªã¹ã¯ããŒã«ã®å®è£ ã§ããããã«ãå±æ§ã䜿çšããŠDOMãªããžã§ã¯ãã®äžéšã®ããããã£ãã¢ãã¡ãŒã·ã§ã³åããã
data-*
ããã³ãã©ãŒonscroll
ã䜿çšããŠä»ã®ã¿ã€ãã®ãªããžã§ã¯ããã¢ãã¡ãŒã·ã§ã³åãããã§ããŸãã
ãã¯ãããžãŒãšããŒã«ã®æ¯èŒ
以äžã¯ãã¹ã¯ããŒã«æè¡ã®æ¯èŒã§ãã
亀差ãªãã¶ãŒããŒAPI | ã¹ã ãŒãºãªã¹ã¯ããŒã« | CSSã®ã¢ã³ã«ãŒãã€ã³ã | CSSèŠå·®å¹æ | CSSããããã£ã®äœçœ®ïŒã¹ãã£ãã㌠| |
èŠçŽ ã®åºå® | - | - | - | - | + |
èŠå·®å¹æ | - | - | - | + | - |
ã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ã®å¶åŸ¡ | ± | - | - | ± | - |
ãã§ãã¯ãã€ã³ãã®äœ¿çš | ± | - | + | - | - |
ã¢ã€ãã ã®åçãããåŠç | + | - | - | - | - |
æ°Žå¹³ã¹ã¯ããŒã«å¹æã®ãµããŒã | + | + | + | + | + |
å¶äœã«é©ããŠããŸãïŒé©åãªãã©ãŠã¶ãŒãµããŒãïŒ | ± | ± | ± | + | ± |
ã¢ãã¡ãŒã·ã§ã³ã®å®å šãªèªç± | - | - | - | - | - |
éçºè ãµããŒã | n / a | n / a | n / a | n / a | n / a |
DOMãCanvasãWebGLãSVGã®æäœ | + | - | - | - | - |
èŠçŽ ã®ãµã€ãºå€æŽã®ãµããŒã | + | + | + | + | + |
ã¢ãã¡ãŒã·ã§ã³ãé¢é£ããã»ã¯ã·ã§ã³ã®ã¿ã«å¶éããŸãã | + | + | + | - | + |
ã¹ã¯ããŒã«æ¹åãåºå¥ããŸã | ± | - | - | - | - |
ãã©ãŠã¶ã«çµã¿èŸŒãŸãããã¯ãããžãŒ | + | + | + | + | + |
以äžã¯ãã¬ãã¥ãŒãããã©ã€ãã©ãªã®æ¯èŒã§ãã
Scrolltrigger | æ©é¢è»ã¹ã¯ããŒã« | ScrollScene | ã¹ã¯ããŒã«ããžã㯠| |
èŠçŽ ã®åºå® | + | ± | + | + |
èŠå·®å¹æ | + | + | + | + |
ã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ã®å¶åŸ¡ | + | ± | ± | ± |
ãã§ãã¯ãã€ã³ãã®äœ¿çš | + | ± | ± | ± |
ã¢ã€ãã ã®åçãããåŠç | + | - | + | - |
æ°Žå¹³ã¹ã¯ããŒã«å¹æã®ãµããŒã | + | + | + | + |
å¶äœã«é©ããŠããŸãïŒé©åãªãã©ãŠã¶ãŒãµããŒãïŒ | + | ± | + | + |
ã¢ãã¡ãŒã·ã§ã³ã®å®å šãªèªç± | + | ± | + | + |
éçºè ãµããŒã | + | + | + | - |
DOMãCanvasãWebGlãSVGã§åäœããŸã | + | ± | + | + |
èŠçŽ ã®ãµã€ãºå€æŽã®ãµããŒã | + | + | + | ± |
ã¢ãã¡ãŒã·ã§ã³ãé¢é£ããã»ã¯ã·ã§ã³ã®ã¿ã«å¶éããŸãã | + | - | ± | ± |
ã¹ã¯ããŒã«æ¹åãåºå¥ããŸã | + | ± | + | + |
ãã©ãŠã¶ã«çµã¿èŸŒãŸãããã¯ãããžãŒ | - | - | - | - |
æŠèŠ
èŠçŽ ã®åºå®ãèŠå·®å¹æãªã©ã®ç¹å¥ãªã¹ã¯ããŒã«ã¡ã«ããºã ãå®è£ ããã«ã¯ãæšæºã®CSSæ©èœã§ååãªå ŽåããããŸãã察å¿ããCSSæ©èœããµããŒãããªããã©ãŠã¶ãŒã«ããªãã£ã«ã䜿çšããå Žåãå°ãªããšãããã¯åœãŠã¯ãŸããŸãã
ç§ã¯éåžžãScrollTriggerã©ã€ãã©ãªã䜿çšããŠã¹ã¯ããŒã«ãã«ã¹ã¿ãã€ãºããããšããå§ãããŸããããã«ãããçŽç²ãªCSSã§å¯èœãªãã¹ãŠã®æ©èœãå®çŸã§ããŸãããã®ã©ã€ãã©ãªã¯ãç¹å®ã®ãã¯ãããžã®ãã©ãŠã¶ãµããŒããåŠçããèšç®ãããç°¡åã«å®è¡ã§ããããã«ããŸããããã«ãããã©ã€ãã©ãªã䜿çšãã人ã¯ãèªåã®ããžãã¹ã«åãæããããšãã§ããŸãã
ãããžã§ã¯ãã§ã¹ã¯ããŒã«ãèšå®ãããšãã«ã©ã®ãã¯ãããžãŒã䜿çšããŸããïŒ