{"id":5070,"date":"2023-09-04T23:14:23","date_gmt":"2023-09-04T14:14:23","guid":{"rendered":"http:\/\/www.lining-moon.casa\/andplus.co.jp\/?p=5070"},"modified":"2026-01-08T11:13:45","modified_gmt":"2026-01-08T02:13:45","slug":"post-5070","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/post-5070\/","title":{"rendered":"Anime.js\u3092\u4f7f\u7528\u3057\u305f\u30b9\u30e0\u30fc\u30b9\u30b9\u30af\u30ed\u30fc\u30eb &#038; GSAP\u3092\u4f7f\u7528\u3057\u305f\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30a2\u30a6\u30c8\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3"},"content":{"rendered":"<h3>\u30b9\u30e0\u30fc\u30b9\u30b9\u30af\u30ed\u30fc\u30eb\u3068\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3<\/h3>\n<p>\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u306e\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u3092\u5411\u4e0a\u3055\u305b\u308b\u305f\u3081\u306b\u3001\u30b9\u30e0\u30fc\u30b9\u30b9\u30af\u30ed\u30fc\u30eb\u3068\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u52b9\u679c\u3092\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Anime.js\u3068GSAP\u3068\u3044\u30462\u3064\u306e\u4eba\u6c17\u306eJavaScript\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u3066\u3001\u3053\u306e\u52b9\u679c\u3092\u5b9f\u73fe\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p><\/p>\n<h4>\u30b3\u30fc\u30c9\u306e\u89e3\u8aac<\/h4>\n<p>\u307e\u305a\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"language-javascript\"><code>\n(function () {\nfunction smoothScroll(event, targetY, fade = false) {\n  event.preventDefault();\n  const timeline = gsap.timeline();\n\n  timeline.to('html, body', { duration: 1, scrollTop: targetY, ease: 'easeOutCubic' }, 0);\n  if (fade) {\n    timeline.to('body', { duration: 0.3, opacity: 0 }, 0.1)\n      .to('body', { duration: 0.3, opacity: 1 }, 0.6);\n  }\n\n  timeline.play();\n}\n\nfunction addSmoothScrollListener(selector, fade = false) {\n  let elements = Array.prototype.slice.call(document.querySelectorAll(selector));\n  for (let i = 0; i &lt; elements.length; i++) {\n    elements[i].addEventListener('click', event =&gt; {\n      const targetElement = document.getElementById(elements[i].getAttribute('href').replace('#', ''));\n      if (targetElement) {\n        const targetY = targetElement.getBoundingClientRect().top + window.scrollY - 60;\n        smoothScroll(event, targetY, fade);\n      } else {\n        console.warn(`Element with ID '${elements[i].getAttribute('href').replace('#', '')}' not found.`);\n      }\n    });\n  }\n}\naddSmoothScrollListener('a[href^=\"#\"]:not(.tabs-link):not(.fade-link)');\naddSmoothScrollListener('a[href^=\"#\"].fade-link', true);\n})();\n<\/code><\/pre>\n<p><\/p>\n<h5>\u95a2\u6570 smoothScroll<\/h5>\n<p>\u3053\u306e\u95a2\u6570\u306f\u3001\u30b9\u30e0\u30fc\u30b9\u30b9\u30af\u30ed\u30fc\u30eb\u3068\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u3044\u307e\u3059\u3002GSAP\u306e\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u3092\u4f7f\u7528\u3057\u3066\u3001html\u3068body\u8981\u7d20\u3092\u30bf\u30fc\u30b2\u30c3\u30c8Y\u4f4d\u7f6e\u307e\u3067\u30b9\u30e0\u30fc\u30b9\u30b9\u30af\u30ed\u30fc\u30eb\u3055\u305b\u307e\u3059\u3002fade\u30d1\u30e9\u30e1\u30fc\u30bf\u304ctrue\u306e\u5834\u5408\u3001body\u8981\u7d20\u306e\u900f\u660e\u5ea6\u3092\u5909\u66f4\u3057\u3066\u30d5\u30a7\u30fc\u30c9\u30a2\u30a6\u30c8\u3068\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><\/p>\n<h5>\u95a2\u6570 addSmoothScrollListener<\/h5>\n<p>\u3053\u306e\u95a2\u6570\u306f\u3001\u6307\u5b9a\u3055\u308c\u305f\u30bb\u30ec\u30af\u30bf\u30fc\u3092\u6301\u3064\u3059\u3079\u3066\u306e\u8981\u7d20\u306b\u30af\u30ea\u30c3\u30af\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u30fc\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u8981\u7d20\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u308b\u3068\u3001smoothScroll\u95a2\u6570\u304c\u547c\u3073\u51fa\u3055\u308c\u3001\u9069\u5207\u306a\u30b9\u30af\u30ed\u30fc\u30eb\u3068\u30d5\u30a7\u30fc\u30c9\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u304c\u884c\u308f\u308c\u307e\u3059\u3002<\/p>\n<p><\/p>\n<h4>\u307e\u3068\u3081<\/h4>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u30b9\u30cb\u30da\u30c3\u30c8\u306f\u3001\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u306b\u30b9\u30e0\u30fc\u30b9\u30b9\u30af\u30ed\u30fc\u30eb\u3068\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u306b\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002Anime.js\u3068GSAP\u306f\u3001\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u7c21\u5358\u304b\u3064\u52b9\u679c\u7684\u306b\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306e\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u3053\u306e\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306e\u30e6\u30fc\u30b6\u30fc\u30a8\u30af\u30b9\u30da\u30ea\u30a8\u30f3\u30b9\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>","protected":false},"excerpt":{"rendered":"\u30b9\u30e0\u30fc\u30b9\u30b9\u30af\u30ed\u30fc\u30eb\u3068\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3 \u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u306e\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u3092\u5411\u4e0a\u3055\u305b\u308b\u305f\u3081\u306b\u3001\u30b9\u30e0\u30fc\u30b9\u30b9\u30af\u30ed\u30fc\u30eb\u3068\u30d5\u30a7\u30fc\u30c9\u30a4\u30f3\u30fb\u30a2\u30a6\u30c8\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u52b9\u679c\u3092\u5b9f[...]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","footnotes":"","vk-ltc-link":"","vk-ltc-target":""},"categories":[12],"tags":[],"group":[],"class_list":["post-5070","post","type-post","status-publish","format-standard","category-javascript"],"acf":[],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/5070","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/comments?post=5070"}],"version-history":[{"count":0,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/5070\/revisions"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=5070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=5070"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=5070"},{"taxonomy":"group","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/group?post=5070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}