[ã¢ããã€ã¹ãèªã]ãµã€ã¯ã«ã®ä»ã®19ã®éšå
ããŒã1ïŒ ãšã³ãžã³ãã©ã³ã¿ã€ã ã¡ã«ããºã ãã³ãŒã«ã¹ã¿ãã¯ã®æŠèŠ
ããŒã2ïŒ V8å éšãšã³ãŒãã®æé©åã«ã€ããŠ
ããŒã3ïŒ ã¡ã¢ãªç®¡çã4çš®é¡ã®ã¡ã¢ãªãªãŒã¯ãããã³ããããšã®æŠã
ããŒã4ïŒ ã€ãã³ãã«ãŒããéåæãããã³éåæ/åŸ æ©ã䜿çšããŠã³ãŒããæ¹åãã5ã€ã®æ¹æ³
ããŒã5ïŒ WebSocketãšHTTP / 2 + SSEã äœãéžã¶ïŒ
ããŒã6ïŒ WebAssemblyã®æ©èœãšç¯å²
ããŒã7ïŒ Web Workersãš5ã€ã®äœ¿çšã·ããªãª
ããŒã8ïŒ ãµãŒãã¹ã¯ãŒã«ãŒ
ããŒã9ïŒ Webããã·ã¥éç¥
ããŒã10ïŒ MutationObserverã䜿çšããŠDOMã®å€æŽã远跡ãã
ããŒã11ïŒ WebããŒãžã¬ã³ããªã³ã°ãšã³ãžã³ãšããã©ãŒãã³ã¹ãæé©åããããã®ãã³ã
ããŒã12ïŒ ããã©ãŒãã³ã¹ãšã»ãã¥ãªãã£ãæé©åãããã©ãŠã¶ãŒã®ãããã¯ãŒã¯ãµãã·ã¹ãã
ããŒã12ïŒ ããã©ãŒãã³ã¹ãšã»ãã¥ãªãã£ãæé©åãããã©ãŠã¶ãŒã®ãããã¯ãŒã¯ãµãã·ã¹ãã
ããŒã13ïŒ CSSãšJavaScriptã䜿çšããã¢ãã¡ãŒã·ã§ã³
ããŒã14ïŒ JSã®ä»çµã¿ïŒæœè±¡æ§æããªãŒã解æãããã³ãã®æé©å
ããŒã15ïŒ JSã®ä»çµã¿ïŒã¯ã©ã¹ãšç¶æ¿ãBabelããã³TypeScriptã§ã®ãã©ã³ã¹ãã¬ãŒã·ã§ã³
ããŒã16ïŒ JSã®ä»çµã¿ïŒã¹ãã¬ãŒãž
ããŒã17ïŒ JSã®ä»çµã¿ïŒShadow DOMãã¯ãããžãŒãšWebã³ã³ããŒãã³ã
ããŒã18ïŒ JSã®ä»çµã¿ïŒWebRTCããã³P2Péä¿¡ã¡ã«ããºã
ããŒã19ïŒ JSã®ä»çµã¿ïŒã«ã¹ã¿ã èŠçŽ
ããŒã2ïŒ V8å éšãšã³ãŒãã®æé©åã«ã€ããŠ
ããŒã3ïŒ ã¡ã¢ãªç®¡çã4çš®é¡ã®ã¡ã¢ãªãªãŒã¯ãããã³ããããšã®æŠã
ããŒã4ïŒ ã€ãã³ãã«ãŒããéåæãããã³éåæ/åŸ æ©ã䜿çšããŠã³ãŒããæ¹åãã5ã€ã®æ¹æ³
ããŒã5ïŒ WebSocketãšHTTP / 2 + SSEã äœãéžã¶ïŒ
ããŒã6ïŒ WebAssemblyã®æ©èœãšç¯å²
ããŒã7ïŒ Web Workersãš5ã€ã®äœ¿çšã·ããªãª
ããŒã8ïŒ ãµãŒãã¹ã¯ãŒã«ãŒ
ããŒã9ïŒ Webããã·ã¥éç¥
ããŒã10ïŒ MutationObserverã䜿çšããŠDOMã®å€æŽã远跡ãã
ããŒã11ïŒ WebããŒãžã¬ã³ããªã³ã°ãšã³ãžã³ãšããã©ãŒãã³ã¹ãæé©åããããã®ãã³ã
ããŒã12ïŒ ããã©ãŒãã³ã¹ãšã»ãã¥ãªãã£ãæé©åãããã©ãŠã¶ãŒã®ãããã¯ãŒã¯ãµãã·ã¹ãã
ããŒã12ïŒ ããã©ãŒãã³ã¹ãšã»ãã¥ãªãã£ãæé©åãããã©ãŠã¶ãŒã®ãããã¯ãŒã¯ãµãã·ã¹ãã
ããŒã13ïŒ CSSãšJavaScriptã䜿çšããã¢ãã¡ãŒã·ã§ã³
ããŒã14ïŒ JSã®ä»çµã¿ïŒæœè±¡æ§æããªãŒã解æãããã³ãã®æé©å
ããŒã15ïŒ JSã®ä»çµã¿ïŒã¯ã©ã¹ãšç¶æ¿ãBabelããã³TypeScriptã§ã®ãã©ã³ã¹ãã¬ãŒã·ã§ã³
ããŒã16ïŒ JSã®ä»çµã¿ïŒã¹ãã¬ãŒãž
ããŒã17ïŒ JSã®ä»çµã¿ïŒShadow DOMãã¯ãããžãŒãšWebã³ã³ããŒãã³ã
ããŒã18ïŒ JSã®ä»çµã¿ïŒWebRTCããã³P2Péä¿¡ã¡ã«ããºã
ããŒã19ïŒ JSã®ä»çµã¿ïŒã«ã¹ã¿ã èŠçŽ
ã¢ãã¡ãŒã·ã§ã³ã¯ãææ°ã®Webã€ã³ã¿ãŒãã§ãŒã¹ã®äžå¯æ¬ ãªéšåã§ãã ãããããã«é©åã§ãé åçã§ãçç£çã§ãããã«ãã£ãŠããµã€ããŸãã¯Webã¢ããªã±ãŒã·ã§ã³ãæäœãããŠãŒã¶ãŒã®å°è±¡ã®ããªãã®å²åãå·Šå³ãããŸãã æ¬æ¥ãJavaScriptããã³é¢é£æè¡ã®æ©èœã«ç¹åããäžé£ã®è³æã®ç¬¬13éšã®ç¿»èš³ã§ãCSSããã³JSã«ãã£ãŠå®è¡ãããã¢ãã¡ãŒã·ã§ã³ã«ã€ããŠèª¬æãããã®æé©åãžã®ã¢ãããŒãã«ã€ããŠèª¬æããŸãã
埩ç¿
ã¢ãã¡ãŒã·ã§ã³ã¯ãçŽç²ã«å®çšçãªåœ¹å²ã«å ããŠãWebã¢ããªã±ãŒã·ã§ã³ã®é åã«å€§ããªåœ±é¿ãäžããããšããåãã§ãããã ãŠãŒã¶ãŒã¯ããããžã§ã¯ãã®UXãã¶ã€ã³ã«ãŸããŸã泚æãæã£ãŠããŸããããã¯ãWebãªãœãŒã¹ã®ææè ãããŠãŒã¶ãŒãå¿«é©ã«æãããµã€ãã§æ¡ä»¶ãäœæããããšã®éèŠæ§ãèªèããããã«ãªããšããäºå®ã«ã€ãªãããŸãã ããããã¹ãŠããããŒãžã®èŠèŠçãªé åãšããŒãžãæäœããå©äŸ¿æ§ã«å ããŠãWebãããžã§ã¯ãããéãããªããã€ã³ã¿ãŒãã§ãŒã¹ã§åçèŠçŽ ã®æ°ãå¢ããŠãããšããäºå®ã«ã€ãªãããŸãã ããã«ã¯ãã¹ãŠãããè€éãªã¢ãã¡ãŒã·ã§ã³ãå¿ èŠã§ããããšãã°ããŠãŒã¶ãŒãWebããŒãžãæäœããŠãããšãã«ãWebããŒãžã®ç¶æ ãã¹ã ãŒãºã«å€åãããããšãã§ããŸãã ä»æ¥ãã¢ãã¡ãŒã·ã§ã³ã¯ç¹å¥ãªãã®ãšã¯ã¿ãªãããŠããŸããã ãŠãŒã¶ãŒã¯ãŸããŸãèŠæ±ãå³ãããªããWebãããžã§ã¯ããã€ã³ã¿ã©ã¯ãã£ããªã¬ã¹ãã³ã·ãã€ã³ã¿ãŒãã§ã€ã¹ãæã€ããšãæåŸ ããããšã«ãã§ã«æ £ããŠããŸãã
ãã ããã€ã³ã¿ãŒãã§ã€ã¹ã®ã¢ãã¡ãŒã·ã§ã³ã¯ããã»ã©åçŽã§ã¯ãããŸããã äœãã¢ãã¡ãŒãããã®ã§ããïŒ ã¢ãã¡ãŒã·ã§ã³åããã¿ã€ãã³ã°ã¯ïŒ ã¢ãã¡ãŒã·ã§ã³ã¯ã©ã®ãããªæèŠãåŒãèµ·ãããŸããïŒ ãããã®è³ªåã«å¯ŸããçããèŠã€ããã«ã¯ãããªãã®åªåãå¿ èŠãªå ŽåããããŸãã
JavaScriptã¢ãã¡ãŒã·ã§ã³ãšCSSã¢ãã¡ãŒã·ã§ã³
ã¢ãã¡ãŒã·ã§ã³ãäœæããã«ã¯ãäž»ã«2ã€ã®æ¹æ³ããããŸããJavaScriptã®äœ¿çšãWebã¢ãã¡ãŒã·ã§ã³APIã®äœ¿çš ãããã³CSSã®äœ¿çšã§ãã æ¹æ³ã®éžæã¯ç¹å®ã®ã¿ã¹ã¯ã«äŸåããã®ã§ãããæè¡ã®å¥ã®æè¡ã®å©ç¹ã«ã€ããŠæ確ã«è©±ãããšã¯äžå¯èœã§ããããšãããã«ææããããšæããŸãã
âCSSã¢ãã¡ãŒã·ã§ã³
CSSã¢ãã¡ãŒã·ã§ã³ã¯ãç»é¢äžãåãåãæãç°¡åãªæ¹æ³ã§ãã X軞ãšY軞ã«æ²¿ã£ãèŠçŽ ã®ç§»åã瀺ãç°¡åãªäŸããå§ããŸãããããã¯ã1000ããªç§ã®æéã«èšå®ãããå€æCSSå€æã䜿çšããŠè¡ãããŸãã
.box { -webkit-transform: translate(0, 0); -webkit-transition: -webkit-transform 1000ms; transform: translate(0, 0); transition: transform 1000ms; } .box.move { -webkit-transform: translate(50px, 50px); transform: translate(50px, 50px); }
move
ã¯ã©ã¹ãè¿œå ãããšã
transform
å€ãå€æŽããã移è¡ãéå§ãããŸãã ç¶ç¶æéã«å ããŠãã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ã調æŽã§ããŸãïŒ
easing
ïŒã ãã®èšå®ã®æ¬è³ªã¯ããŠãŒã¶ãŒãã¢ãã¡ãŒã·ã§ã³ãç¥èŠããæ¹æ³ã«åœ±é¿ããããšã§ãã ã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ã«ã€ããŠã¯åŸã§èª¬æããŸãã
次ã®å³ã¯ãææ°ã®ãã©ãŠã¶ãŒã®CSSãµããŒãã瀺ããŠããŸãã
ææ°ã®ãã©ãŠã¶ãŒã§ã®CSS移è¡ã®ãµããŒã
ã芧ã®ãšããããã®æ©èœã«ã¯éåžžã«é«ãã¬ãã«ã®ãµããŒãããããŸãã
åã®ã³ãŒãã¹ããããã®ããã«ãåå¥ã®CSSã¯ã©ã¹ãäœæããŠã¢ãã¡ãŒã·ã§ã³ãå¶åŸ¡ããå ŽåãJavaScriptã䜿çšããŠã¢ãã¡ãŒã·ã§ã³ãæå¹ãŸãã¯ç¡å¹ã«ã§ããŸãã
次ã®èŠçŽ ããããšããŸãã
<div class="box"> Sample content. </div>
JavaScriptã䜿çšããŠãã¢ãã¡ãŒã·ã§ã³ãéå§ããã³åæ¢ã§ããŸãã
var boxElements = document.getElementsByClassName('box'), boxElementsLength = boxElements.length, i; for (i = 0; i < boxElementsLength; i++) { boxElements[i].classList.add('move'); }
ãã®ã³ãŒãã®æçã§ã¯ãã¢ãã¡ãŒã·ã§ã³ãéå§ããããã«ã
box
ã¯ã©ã¹ãå²ãåœãŠãããŠãããã¹ãŠã®èŠçŽ ãååŸãã
move
ã¯ã©ã¹ããããã«è¿œå ããŸãã
åæ§ã®CSSå ±ææ©èœ-ã¢ãã¡ãŒã·ã§ã³ã®èª¬æãšJS-éå§ãšç¡å¹åã®ããã«ãã¢ããªã±ãŒã·ã§ã³ã®ãã©ã³ã¹ãããããŸãã éçºè ã¯ãé©åãªã¯ã©ã¹ãã¿ãŒã²ããèŠçŽ ã«å²ãåœãŠãã ãã§ããã©ãŠã¶ãCSSã䜿çšããŠèšè¿°ãããã¢ãã¡ãŒã·ã§ã³ãåå¥ã«å®è¡ã§ããããã«ããããšã§ãJavaScriptããèŠçŽ ã®ç¶æ ã管çããããšã«éäžã§ããŸãã ã¢ãã¡ãŒã·ã§ã³ãæäœããåæ§ã®ã·ããªãªã詳ãã調ã¹ããšãèŠçŽ ã®
transitionend
ã€ãã³ãããªãã¹ã³ã§ããŸãããå€ãããŒãžã§ã³ã®Internet ExplorerããµããŒãããŠããå Žåã«ã®ã¿ãããè¡ãå¿ èŠããããŸãã
transitionend
ã€ãã³ãã¯ãé·ç§»ã®çµããã«çºçããŸãã ããã䜿çšããæ¹æ³ã次ã«ç€ºããŸãã
var boxElement = document.querySelector('.box'); // box. boxElement.addEventListener('transitionend', onTransitionEnd, false); function onTransitionEnd() { // . }
Webã€ã³ã¿ãŒãã§ãŒã¹èŠçŽ ãããåçã«ããããã«ãCSSãã©ã³ãžã·ã§ã³ã®äœ¿çšã«å ããŠãCSSã¢ãã¡ãŒã·ã§ã³ã䜿çšã§ããŸãã ããã«ãããéçºè ã¯ãã¢ãã¡ãŒã·ã§ã³ã®åã ã®ããŒãã¬ãŒã ãã¢ãã¡ãŒã·ã§ã³ã®ã¹ããŒãžã®ç¶ç¶æéãããã³ã¢ãã¡ãŒã·ã§ã³ã®å埩ãã¯ããã«é«ãã¬ãã«ã§å¶åŸ¡ã§ããŸãã
ããŒãã¬ãŒã ã¯ãç¹å®ã®æéã«ã©ã®CSSããããã£å€ãå¿ èŠãããã©ãŠã¶ã«äŒããããã«äœ¿çšãããŸãã ãã©ãŠã¶ã¯ãããããŒãã¬ãŒã ããå¥ã®ããŒãã¬ãŒã ã«ç§»åãããšãã«ãããããã£ã®äžéå€ãåå¥ã«èŠã€ããŸãã
äŸãèããŠã¿ãŸãããã
/** * - * . * ( ), * ! */ .box { /* */ animation-name: movingBox; /* */ animation-duration: 2300ms; /* - */ animation-iteration-count: infinite; /* */ animation-direction: alternate; } @keyframes movingBox { 0% { transform: translate(0, 0); opacity: 0.4; } 25% { opacity: 0.9; } 50% { transform: translate(150px, 200px); opacity: 0.2; } 100% { transform: translate(40px, 30px); opacity: 0.8; } }
ãã®ã³ãŒãã®ä»çµã¿ã瀺ãããŒãžã次ã«ç€ºããŸã ã
CSSã¢ãã¡ãŒã·ã§ã³ã䜿çšãããšãã¿ãŒã²ããèŠçŽ ã«é¢ä¿ãªãã¢ãã¡ãŒã·ã§ã³èªäœãèšè¿°ããã
animation-name
ããããã£ã䜿çšããŠç®çã®ã¢ãã¡ãŒã·ã§ã³ãéžæããŸãã
ãããŸã§ã®CSSã¢ãã¡ãŒã·ã§ã³ã§ã¯ããã©ãŠã¶éçºè ãã¬ãã£ãã¯ã¹ã®äœ¿çšãå¿ èŠã«ãªãå ŽåããããŸãã ãã®ããã
-webkit-
ãã¬ãã£ãã¯ã¹
-webkit-
ãSafariãSafari Mobileãããã³Androidãã©ãŠã¶ãŒã§äœ¿çšãããŸãã ChromeãOperaãInternet ExplorerãFirefoxã§ã¯ãã¢ãã¡ãŒã·ã§ã³ã¯ãã¬ãã£ãã¯ã¹ãªãã§æ©èœããŸãã ãã¬ãã£ãã¯ã¹ä»ãã®CSSã³ãŒããäœæããã«ã¯ãå€ãã®è£å©ããŒã«ã䜿çšã§ããŸããããã«ãããéçºè ã¯ã¢ãã¡ãŒã·ã§ã³ã®ãœãŒã¹ã³ãŒãã§ãã¬ãã£ãã¯ã¹ãªãã§å®è¡ã§ããŸãã
âJavaScriptã¢ãã¡ãŒã·ã§ã³
Webã¢ãã¡ãŒã·ã§ã³APIã䜿çšããŠJavaScriptã䜿çšããŠã¢ãã¡ãŒã·ã§ã³ãäœæããããšã¯ãCSSãã©ã³ãžã·ã§ã³ãšCSSã¢ãã¡ãŒã·ã§ã³ã䜿çšãããããå°é£ã§ãããéåžžããã®ã¢ãããŒãã«ããéçºè ã¯ãã匷åã«ãªããŸãã
JSã¢ãã¡ãŒã·ã§ã³ã¯ãã¢ããªã±ãŒã·ã§ã³ã³ãŒãã§èª¬æãããŠããŸãã ä»ã®ã³ãŒããšåæ§ã«ãããšãã°ããªããžã§ã¯ãã«é 眮ã§ããŸãã äžèšã®CSSãã©ã³ãžã·ã§ã³ãåäœæããããã«èšè¿°ããå¿ èŠãããJSã³ãŒãã®äŸã次ã«ç€ºããŸãã
var boxElement = document.querySelector('.box'); var animation = boxElement.animate([ {transform: 'translate(0)'}, {transform: 'translate(150px, 200px)'} ], 500); animation.addEventListener('finish', function() { boxElement.style.transform = 'translate(150px, 200px)'; });
ããã©ã«ãã§ã¯ãWeb Animation APIã䜿çšãããšãèŠçŽ ã®å€èŠ³ã®ã¿ãå€æŽãããŸãã ãªããžã§ã¯ããã¢ãã¡ãŒã·ã§ã³äžã«ç§»åããäœçœ®ã«æ®ãããå Žåã¯ãã¢ãã¡ãŒã·ã§ã³ã®æåŸã«ã¹ã¿ã€ã«ãå€æŽããå¿ èŠããããŸãã ãã®ãããäžèšã®äŸã§ã¯ã
finish
ã€ãã³ãããªãã¹ã³ãã
box.style.transform
èŠçŽ
box.style.transform
ã
translate(150px, 200px)
ã«èšå®ããŸããããã¯ãJSããŒã«ã«ãã£ãŠå®è¡ããã2çªç®ã®å€æã䜿çšããŠãªããžã§ã¯ãã§è¡ãããã®ãšåãããšãè¡šããŸãã
JavaScriptã¢ãã¡ãŒã·ã§ã³ã䜿çšããå Žåãéçºè ã¯ã¢ãã¡ãŒã·ã§ã³ã®å段éã§èŠçŽ ã®ã¹ã¿ã€ã«ãå®å šã«å¶åŸ¡ã§ããŸãã ããã¯ãã¢ãã¡ãŒã·ã§ã³ãä»»æã®æ¹æ³ã§æžéãäžæåæ¢ãåæ¢ãå転ããŸãã¯æäœã§ããããšãæå³ããŸãã ããã¯ãèŠçŽ ã®åäœãé©åã«ã«ãã»ã«åã§ããããããªããžã§ã¯ãæåã®ã¢ãããŒãã䜿çšããŠéçºããè€éãªã¢ããªã±ãŒã·ã§ã³ãäœæããå Žåã«ç¹ã«åœ¹ç«ã¡ãŸãã
ã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹
ãªããžã§ã¯ãã®èªç¶ãªåãã«ããããŠãŒã¶ãŒã¯Webã¢ããªã±ãŒã·ã§ã³ã§äœæ¥ãããšãã«å¿«é©ã«æããããšãã§ãããŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãåäžããŸãã
ãªããžã§ã¯ããçŸå®ã®äžçã§ã©ã®ããã«ç§»åãããã«ã€ããŠè©±ããšãããšãã°ããªããžã§ã¯ãã¯çŽç·çã«ç§»åããªãããšãããããŸãã ç©ççãªäžçã§ã¯ã移åãããªããžã§ã¯ãã¯ããŸããŸãªç°å¢èŠå ã®åœ±é¿ãåãããããå éããã³æžéãããŸãã 人éã®è³ã¯ãªããžã§ã¯ããããã®ãããªåããæåŸ ããããšã«æ £ããŠãããããWebã¢ããªã±ãŒã·ã§ã³ãã¢ãã¡ãŒãããå Žåã¯ããããèæ ®ããå¿ èŠããããŸãã
ããã«ãã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ã«ã€ããŠè©±ããšãã«åœ¹ç«ã€ããã€ãã®çšèªã瀺ããŸãã ã€ãŸããããããå¹³æ»åé¢æ°ã«ã€ããŠè©±ããŸãããã ãããã®ã¢ããªã±ãŒã·ã§ã³ã«ãããã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ã«åœ±é¿ãäžããããšãã§ããŸãã
-
ease-in
ã¯ãæåã«é©çšããããšãã«ã¢ãã¡ãŒã·ã§ã³ããã£ããå®è¡ãããåŸãåŸã ã«å éãããæ©èœã§ãã
-
ease-out
ã¯ã䜿çšæã®æ©èœã§ãããã¢ãã¡ãŒã·ã§ã³ã¯ããã«éå§ããããã®åŸåŸã ã«é ããªããŸãã
ãããã®æ©èœã¯çµã¿åãããããšãã§ããŸãã ãã®çµæãããšãã°ã
ease-in-out
æ©èœãååŸã§ããŸãã
ã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ãå¶åŸ¡ãããšããªããžã§ã¯ãã®åããããèªç¶ã«æããããšãã§ããŸãã
animationã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ãå¶åŸ¡ããããã®ããŒã¯ãŒã
CSSãã©ã³ãžã·ã§ã³ãšã¢ãã¡ãŒã·ã§ã³ã«ãããéçºè ã¯ã¹ã ãŒãºæ©èœãéžæã§ããŸãã ã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ã«åœ±é¿ããããŸããŸãªããŒã¯ãŒãããããŸãã ããã«ãç¬èªã®å¹³æ»åæ©èœãäœæã§ããŸãã 以äžã¯ãCSSã§ã¢ãã¡ãŒã·ã§ã³ã®ãã€ããã¯ã¹ãå¶åŸ¡ããããã«äœ¿çšã§ããããŒã¯ãŒãã§ãã
- ç·åœ¢
- ã€ãŒãºã€ã³
- ã€ãŒãºã¢ãŠã
- ã€ãŒãºã€ã³ã¢ãŠã
ããããã¢ãã¡ãŒã·ã§ã³ã«ã©ã®ããã«åœ±é¿ããããç¥ãããã«ããããããã詳现ã«æ€èšããŸãã
linearã¢ãã¡ãŒã·ã§ã³ãªãã¢
linear
ããŒã¯ãŒãã䜿çšãããšãç·åœ¢ã¢ãã¡ãŒã·ã§ã³ã䜿çšã§ããŸãã å®éããã®ã¢ãã¡ãŒã·ã§ã³ã¯ç·åœ¢é¢æ°ã«ãã£ãŠèšè¿°ãããŸãããã®é¢æ°ã§ã¯ããªããžã§ã¯ãã¯äžå®ã®é床ã§å éããã³æžéããã«ã¢ãã¡ãŒã·ã§ã³åãããŸãã
ç·åœ¢CSSé·ç§»ã°ã©ãã¯æ¬¡ã®ããã«ãªããŸãã
ç·åœ¢ã¢ãã¡ãŒã·ã§ã³
æéã®çµéãšãšãã«ãå€ãåäžã«å¢å ããããšãããããŸãã ãã ããçŽç·çãªåãã¯äžèªç¶ã«æããããŸãã äžè¬ã«ããã®ãããªã¢ãã¡ãŒã·ã§ã³ã¯é¿ããŠãã ããã
ãã®ãããªã¢ãã¡ãŒã·ã§ã³ã®èª¬æã¯æ¬¡ã®ãšããã§ãã
transition: transform 500ms linear;
âç°¡åãªã¢ãã¡ãŒã·ã§ã³
æ¢ã«è¿°ã¹ãããã«ã
ease-out
æ©èœã䜿çšãããšãããã»ã¹ã®éå§æã«ã¢ãã¡ãŒã·ã§ã³ã®é床ãéããªãïŒç·åœ¢é¢æ°ãé©çšããå Žåãããé«éã«ãªããŸãïŒãã¢ãã¡ãŒã·ã§ã³ã®çµããã«é ããªããŸãã ãã®ãããªã¢ãã¡ãŒã·ã§ã³ã®ã°ã©ãã£ã«ã«ãªè¡šç€ºã¯æ¬¡ã®ãšããã§ãã
ã€ãŒãºã¢ãŠãã¢ãã¡ãŒã·ã§ã³
äžè¬ã«ããã®ãããªã¢ãã¡ãŒã·ã§ã³ã¯ãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ã«é©ããŠããŸããã¯ã€ãã¯ã¹ã¿ãŒãã¯èŠçŽ ã®å¿çæ§ãæããããäžæ¹ãã¢ãã¡ãŒã·ã§ã³ã®çµããã®ã¹ããŒããŠã³ã¯äžåäžãªåãã®ååšã«ããèªç¶ã«ãªããŸãã
ãã®å¹æãå®çŸããã«ã¯å€ãã®æ¹æ³ããããŸãããæãç°¡åãªæ¹æ³ã¯CSSã§
ease-out
ããŒã¯ãŒãã䜿çšãã
ease-out
ã§ãã
transition: transform 500ms ease-out;
âã€ãŒãžãŒã€ã³ã¢ãã¡ãŒã·ã§ã³
ãã®ã¢ãã¡ãŒã·ã§ã³ã¯ãä»èŠããã®ã®å察ã§ãã ããã¯ãéå§æã®äœéãšçµäºæã®é床ã®å¢å ã«ãã£ãŠç¹åŸŽä»ããããŸãã ããã圌女ã®ã°ã©ãã£ãã¯è¡šçŸã§ãã
ã€ãŒãºã€ã³ã¢ãã¡ãŒã·ã§ã³
ease-out
ã¢ãã¡ãŒã·ã§ã³ãšæ¯èŒããŠã
ease-in
ã¢ãã¡ãŒã·ã§ã³ã¯ãéå§ãé ãããã«èŠçŽ ã®å¿çæ§ãäœããšããæèŠãäžãããããç°åžžã«èŠããŸãã ã¢ãã¡ãŒã·ã§ã³ã®é床ã¯æéãšãšãã«å¢å ãããããæåŸã®å éãå¥åŠãªæèŠãçã¿åºããŸãããçŸå®äžçã®ãªããžã§ã¯ãã¯ãåæ¢ããåã«éåžžã¯é ããªããŸãã
åã®ã¢ãã¡ãŒã·ã§ã³ãšåæ§ã«ããã®ã¢ãã¡ãŒã·ã§ã³ã掻çšããã«ã¯ã
ease-in
ããŒã¯ãŒãã䜿çšã§ããŸãã
transition: transform 500ms ease-in;
âç°¡åãªã¢ãã¡ãŒã·ã§ã³
ãã®ã¢ãã¡ãŒã·ã§ã³ã¯ã
ease-out
ã¢ãã¡ãŒã·ã§ã³ãš
ease-out
ã¢ãã¡ãŒã·ã§ã³ã®çµã¿åããã§ãã 圌女ã®ã¹ã±ãžã¥ãŒã«ã¯æ¬¡ã®ãšããã§ãã
ã€ãŒãºã€ã³ã¢ãŠãã¢ãã¡ãŒã·ã§ã³
æç¶æéãé·ãããã¢ãã¡ãŒã·ã§ã³ã䜿çšããããšã¯æšå¥šãããªãããšã«æ³šæããŠãã ãããããã¯ãã€ã³ã¿ãŒãã§ãŒã¹ããã®å¹æã«å¿çããªããªã£ããšããæèŠããŠãŒã¶ãŒã«äžããããã§ãã
ease-in-out
ããŒã¯ãŒãã䜿çšããŠããã®ã¢ãã¡ãŒã·ã§ã³ãå©çšã§ããŸãã
transition: transform 500ms ease-in-out;
ownç¬èªã®å¹³æ»åé¢æ°ã®äœæ
éçºè ã¯ç¬èªã®å¹³æ»åæ©èœãå®çŸ©ã§ããŸããããã«ããããããžã§ã¯ãã§äœ¿çšãããã¢ãã¡ãŒã·ã§ã³ãäœæãããŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãããé©åã«å¶åŸ¡ã§ããŸãã
å®éãäžã§èª¬æããããŒã¯ãŒãïŒ
ease-in
ã
ease-out
ã
linear
ïŒã¯ããžã§æ²ç· ã§ã ãã¢ãã¡ãŒã·ã§ã³ãå¶åŸ¡ããããã®äœ¿çšã®è©³çŽ°ã«ã€ããŠã¯ã ãã¡ããšãã¡ããã芧ãã ãã ã ç¬èªã®å¹³æ»åé¢æ°ã®äœæã¯ãããã«åºã¥ããŠããããããããã«æéãäžããŸãã
âããžã§æ²ç·
ããžã§æ²ç·ãäœæããã«ã¯ã4ã€ã®å€ããŸãã¯æ£ç¢ºã«ã¯2ã€ã®æ°å€ã®ãã¢ãå¿ èŠã§ãã åãã¢ã¯ã3次ããžã§æ²ç·ã®åºæºç¹ã®X座æšãšY座æšãè¡šããŸãã æ²ç·èªäœã¯åº§æšïŒ0ã0ïŒã§å§ãŸãã座æšïŒ1ã1ïŒã§çµãããŸãã ã³ã³ãããŒã«ãã€ã³ãã®ããããã£ãæ§æã§ããŸãã å¶åŸ¡ç¹ã®X座æšã®å€ã¯[0ã1]ã®ç¯å²å ã«ããå¿ èŠããããYã®å€ã[0ã1]ã®ç¯å²å ã«ããå¿ èŠããããŸãããä»æ§ã§ã¯ãã®ç¹ãå®å šã«æ確ã«ããªãããšã«æ³šæããŠãã ããã
å¶åŸ¡ç¹ã®åº§æšã®Xå€ãšYå€ã®å°ããªå€åã§ãããæ²ç·ã«å€§ããªå€åããããããŸãã åºæºç¹ãéåžžã«è¿ãã座æšãç°ãªãããžã§æ²ç·ã®ã°ã©ããããã€ãèŠãŠã¿ãŸãããã
æåã®ããžã§æ²ç·
2çªç®ã®ããžã§æ²ç·
ã芧ã®ãšãããããã2ã€ã®ã°ã©ãã¯äºãã«å€§ããç°ãªã£ãŠããŸãã CSSã®2çªç®ã®æ²ç·ã®èª¬æã¯æ¬¡ã®ãšããã§ãã
transition: transform 500ms cubic-bezier(0.465, 0.183, 0.153, 0.946);
æåã®2ã€ã®æ°å€ã¯æåã®åºæºç¹ã®Xããã³Y座æšã§ããã2çªç®ã®ãã¢ã¯2çªç®ã®åºæºç¹ã®åº§æšã§ãã
ã¢ãã¡ãŒã·ã§ã³ããã©ãŒãã³ã¹ã®æé©å
ã€ã³ã¿ãŒãã§ã€ã¹ãã¢ãã¡ãŒããããšãã¯ããã¬ãŒã ã¬ãŒãã60 FPSãäžåããªãããã«ããå¿ èŠããããŸããããããªããšãã¢ãã¡ãŒã·ã§ã³ããŒãžã®èªèæ¹æ³ã«æªåœ±é¿ãåã³ãŸãã
ãã®äžçã®ä»ã®ãã¹ãŠãšåæ§ã«ãããªãã¯ã¢ãã¡ãŒã·ã§ã³ã®è²»çšãæ¯æãå¿ èŠããããŸãã ãã ããäžéšã®ããããã£ãã¢ãã¡ãŒãããããšã¯ãä»ã®ããããã£ãã¢ãã¡ãŒãããããããå®ãããªããŸãã ããšãã°ãèŠçŽ ã®
width
ãš
height
ããããã£ãã¢ãã¡ãŒããããšããžãªã¡ããªãå€æŽãããããŒãžäžã®ä»ã®èŠçŽ ã移åãŸãã¯ãµã€ãºå€æŽãããå¯èœæ§ããããŸãã ãã®ããã»ã¹ã¯ããŒãžã¬ã€ã¢ãŠããšåŒã°ããŸãã ããã«ã€ããŠã¯ã以åã®è³æã§èª¬æããŸããã
äžè¬ã«ãããŒãžã¬ã€ã¢ãŠããå€æŽãŸãã¯åæç»ããèŠçŽ ã®ããããã£ãã¢ãã¡ãŒã·ã§ã³åããããšã¯é¿ããŠãã ããã æè¿ã®ã»ãšãã©ã®ãã©ãŠã¶ã§ã¯ãããã¯
opacity
å¶éãšã¢ãã¡ãŒã·ã§ã³ã®
transform
æå³ããŸãã
âCSSããããã£ã¯å€æŽãããŸã
will-change CSSããããã£ã䜿çšããŠãèŠçŽ ããããã£ãå€æŽããã€ããã§ããããšããã©ãŠã¶ã«äŒããããšãã§ããŸãã ããã«ããããã©ãŠã¶ã¯ã¢ãã¡ãŒã·ã§ã³ãå®è¡ããåã«é©åãªæé©åãé©çšã§ããŸãã ãã ãã
will-change
ããããã£ãæªçšããªãã§ãã ããããã©ãŠã¶ãŒãªãœãŒã¹ã®æµªè²»ã«ã€ãªãããããã©ãŒãã³ã¹ã®åé¡ã«ã€ãªããå¯èœæ§ããããŸãã
ããã§ãããšãã°ã
transform
ããã³
opacity
ã¢ãã¡ãŒã·ã§ã³ã«ãã®ããããã£ãè¿œå ããæ¹æ³ïŒ
.box { will-change: transform, opacity; }
ãã®ããããã£ã¯ãã¹ãŠã®ãã©ãŠã¶ã§ãŸã ç解ãããŠããŸããããChromeãFirefoxãOperaã§ãµããŒããããŠããŸãã
will-changeããããã£ã®CSSãµããŒã
âJavaScriptãŸãã¯CSSïŒ
ã¢ãã¡ãŒã·ã§ã³ã«éžæãããã®-JSãŸãã¯CSSããåŒã³åºãããWebã¢ãã¡ãŒã·ã§ã³API ããªãã¯ããããããã®ãããªè³ªåã«æ確ã«çããããšã¯ã§ããªããšç§ãã¡ãèšã£ãããšãèŠããŠããŸãã ãã ãããã¯ãããžã決å®ããããã«ã¯ã次ã®èæ ®äºé ãèæ ®ããŠãã ããã
- CSSã¢ãã¡ãŒã·ã§ã³ãšWebã¢ãã¡ãŒã·ã§ã³ã¯ããã€ãã£ãã«ãµããŒããããŠããå Žåãéåžžãã³ã³ããžã¿ãŒã¹ã¬ããã«ãã£ãŠåŠçãããŸãã ãã©ãŠã¶ã®ã¡ã€ã³ã¹ã¬ããïŒã¡ã€ã³ã¹ã¬ããïŒãšã¯ç°ãªããèŠçŽ ã®ã¹ã¿ã€ã«èšå®ãã¬ã€ã¢ãŠãã®äœæãç»é¢ãžã®ããŒã¿ã®è¡šç€ºãJSã³ãŒãã®å®è¡ãè¡ãã¿ã¹ã¯ãå®è¡ãããŸãã ã€ãŸãããã©ãŠã¶ãã¡ã€ã³ã¹ã¬ããã§ããã€ãã®è€éãªã¿ã¹ã¯ãå®è¡ããå Žåãã¢ãã¡ãŒã·ã§ã³ã¯äžæããããšãªãæ£åžžã«å®è¡ãããŸãã
- å€æããã³
opacity
ã¢ãã¡ãŒã·ã§ã³ã¯ãå€ãã®å Žåãã³ã³ããžã·ã§ã³ã¹ããªãŒã ã§åŠçã§ããŸãã
- äœããã®ã¢ãã¡ãŒã·ã§ã³ã«ãã£ãŠããŒãžã®åæç»ãŸãã¯ã¬ã€ã¢ãŠãã®å€æŽãçºçããå Žåãã¡ã€ã³ã¹ã¬ãããæ©èœããå¿
èŠããããŸãã ããã¯ãCSSã¢ãã¡ãŒã·ã§ã³ãšJSã¢ãã¡ãŒã·ã§ã³ã®äž¡æ¹ã«åœãŠã¯ãŸããŸãã ã¬ã€ã¢ãŠãã®å€æŽãŸãã¯ããŒãžã®åæç»ã«ãã£ãŠã·ã¹ãã ã«è¿œå ã®è² è·ãããããšãCSSãŸãã¯JavaScriptã«ãã£ãŠè§£æ±ºãããã¿ã¹ã¯ã®å®è¡ãé
ããªããã·ã¹ãã ãå°é£ãªäœçœ®ã«çœ®ãããå¯èœæ§ããããŸãã
animationã¢ãã¡ãŒã·ã§ã³çšã®ãªããžã§ã¯ãã®éžæ
ææ ®æ·±ãã¢ãã¡ãŒã·ã§ã³ã¯ããããžã§ã¯ãããŠãŒã¶ãŒã«ãšã£ãŠããé¢çœãé åçãªãã®ã«ããŸãã 圌ãã¯åœŒãšäžç·ã«ä»äºãããŠåãã§ããŸãã èŠçŽ ã®å¹ ãšé«ããç»é¢äžã®äœçœ®ãè²ãèæ¯ãªã©ãã»ãšãã©äœã§ãã¢ãã¡ãŒã·ã§ã³åã§ããŸãã ãã ããäœããã¢ãã¡ãŒã·ã§ã³åããèšç»ãç«ãŠããšãã¯ãããã©ãŒãã³ã¹ã«ã€ããŠèããå¿ èŠããããŸãã é©åã«éžæãããŠããªãã¢ãã¡ãŒã·ã§ã³ã¯ããŠãŒã¶ãŒããããžã§ã¯ããèªèããæ¹æ³ã«æªåœ±é¿ãäžããå¯èœæ§ããããããã¢ãã¡ãŒã·ã§ã³ã¯é«éã§é¢é£æ§ãé«ããã®ã§ãªããã°ãªããŸããã å®éãã€ã³ã¿ãŒãã§ã€ã¹ã«èªç¶ããšé åãäžããæå°éã®ã¢ãã¡ãŒã·ã§ã³ã«å¶éããããšã¯åªåãã䟡å€ããããŸãã
animationã¢ãã¡ãŒã·ã§ã³ã䜿çšããŠãŠãŒã¶ãŒã€ã³ã¿ã©ã¯ã·ã§ã³ããµããŒããã
æè¡çãªèœåããããããšãã£ãŠãã¢ãã¡ãŒã·ã§ã³åãã¹ãã§ã¯ãããŸããã 代ããã«ãæ éã«éžæãããã¢ãã¡ãŒã·ã§ã³ã䜿çšããŠãããŒãžèŠçŽ ãšãŠãŒã¶ãŒã®å¯Ÿè©±ãæ¹åããŸãã ãŠãŒã¶ãŒã®ã¢ã¯ãã£ããã£ãäžæãŸãã¯åŠšå®³ããã¢ãã¡ãŒã·ã§ã³ã¯é¿ããŠãã ããã
systemã·ã¹ãã ã«å€§ããªè² è·ããããã¢ãã¡ãŒã·ã§ã³
äžé©åãªã¢ãã¡ãŒã·ã§ã³ãããæªãã®ã¯ãããŒãžããäžæãããã¢ãã¡ãŒã·ã§ã³ã ãã§ãã Webãããžã§ã¯ãã®ãŠãŒã¶ãŒã¯ééããªãããã奜ã¿ãŸããã
ãŸãšã
ãã®èšäºã§ã¯ãCSSãšJavaScriptã䜿çšããWebããŒãžèŠçŽ ã®ã¢ãã¡ãŒã·ã§ã³åã«ã€ããŠèª¬æããŸããã ã¢ãã¡ãŒã·ã§ã³ã¯åŒ·åãªããŒã«ãªã®ã§ãæ éã«æ±ãå¿ èŠããããŸãã é©åãªã¢ãããŒãã䜿çšãããšãã¢ãã¡ãŒã·ã§ã³ã¯WebãªãœãŒã¹ãæäœãããŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãå€§å¹ ã«æ¹åã§ããŸãã
äžé£ã®èšäºã®åã®éšåïŒ
ããŒã1ïŒ JSã®ä»çµã¿ïŒãšã³ãžã³ãã©ã³ã¿ã€ã ã¡ã«ããºã ãã³ãŒã«ã¹ã¿ãã¯ã®æŠèŠ
ããŒã2ïŒ JSã®ä»çµã¿ïŒV8å éšãšã³ãŒãã®æé©åã«ã€ããŠ
ããŒã3ïŒ JSã®ä»çµã¿ïŒã¡ã¢ãªç®¡çã4çš®é¡ã®ã¡ã¢ãªãªãŒã¯ãããã³ããããšã®æŠã
ããŒã4ïŒ JSã®ä»çµã¿ïŒã€ãã³ãã«ãŒããéåæãããã³async / awaitã䜿çšããŠã³ãŒããæ¹åãã5ã€ã®æ¹æ³
ããŒã5ïŒ JSã®ä»çµã¿ïŒWebSocketãšHTTP / 2 + SSEã äœãéžã¶ïŒ
ããŒã6ïŒ JSã®ä»çµã¿ïŒWebAssemblyã®æ©èœãšç¯å²
ããŒã7ïŒ JSã®ä»çµã¿ïŒWeb Workersãš5ã€ã®äœ¿çšã·ããªãª
ããŒã8ïŒ JSã®ä»çµã¿ïŒãµãŒãã¹ã¯ãŒã«ãŒ
ããŒã9ïŒ JSã®ä»çµã¿ïŒWebããã·ã¥éç¥
ããŒã10ïŒ JSã®ä»çµã¿ïŒMutationObserverã䜿çšããŠDOMã®å€æŽã远跡ãã
ããŒã11ïŒ JSã®ä»çµã¿ïŒWebããŒãžã¬ã³ããªã³ã°ãšã³ãžã³ãšããã©ãŒãã³ã¹ãæé©åããããã®ãã³ã
ããŒã12ïŒ JSïŒãã©ãŠã¶ãŒãããã¯ãŒã¯ãµãã·ã¹ãã ãããã©ãŒãã³ã¹ãšã»ãã¥ãªãã£ã®æé©å
芪æãªãèªè ïŒ ã¢ãã¡ãŒã·ã§ã³ãWebãªãœãŒã¹ã®æäœãå®éã«åŠšããå Žåã«çŽé¢ããããšããããŸããïŒ