下から開く写真の窓が、スクロールで外側の幅まで広がる冒頭
hy-hero-unveil ・ v1.0.0 ・ 冒頭 ・ 2 節 ・ 吸収元:ひよりケアグループ(HIYORI CARE)(1d0bdd6)
開いたとき:0.1 秒後から、見出しが下 40%・上から閉じた切り抜き(inset(0 0 100% 0))から 0.95 秒 hy.soft(cubic-bezier(.22,1,.36,1))で立ち上がり、導入文(0.22 秒・y 18)とボタン(0.3 秒・y 14)が続く。写真の窓は 0.28 秒から、上 16% の切り抜きから 1.2 秒 hy.out(cubic-bezier(.19,1,.22,1))で開き、中の写真は 1.08 → 1(1.4 秒)。検索のカプセルは 0.65 秒から y 18 → 0。スクロール:ページの頭から 60vh(最低 200px)までの間に、窓の左右の切り抜き(--hx)が『大きな写真の幅(--media)』から『外側の幅(--shell)』まで縮んで 0 になり、角丸(--hr)は 1.14 倍に(scrub 0.55)。写真は窓を通り過ぎる間に yPercent 0 → 6。窓の上では 3 本の色の弧が 24 秒の周期の 3 つの区間(0.5〜4.3・7.9〜11.6・15.5〜19.2 秒)で 1.3 秒かけて引かれ(3 乗の減速)、区間の最後の 0.7 秒で消える(映像があれば映像の時刻に合わせる)。
ライブデモは APPROVED の版から写したコード(library/heroes/hy-hero-unveil/src)をこの場で動かしている。動き:オフは見本の決まり(html.reduced)で止めた形。
記録
吸収元との比較
一致 (止めた状態 1% 以下・動きの各コマ 3% 以下・誤りなし)
| 幅 | 止めた状態の差 | 動きのコマ(時刻:差) | やり直し |
|---|---|---|---|
| 390px | 0.00% | 0ms 0.00% / 250ms 0.70% / 500ms 1.08% / 900ms 1.12% / 1300ms 1.30% / 1700ms 1.30% / 2300ms 0.00% / 2700ms 0.00% / 3200ms 0.00% | 0 |
| 1440px | 0.00% | 0ms 0.00% / 250ms 0.49% / 500ms 1.20% / 900ms 1.34% / 1300ms 1.95% / 1700ms 1.95% / 2300ms 0.00% / 2700ms 0.00% / 3200ms 0.00% | 0 |
比べた日時 2026-12-04 21:50(UTC)。吸収元 /shindan/mihon/hiyori と LAB のデモを、節を同じ高さに置き、時計を止めて同じ時刻に撮った。文字は両方ともグレーの描き方。
出所
- 見本
- ひよりケアグループ(HIYORI CARE) APPROVED
- 版
- 1d0bdd63c5909b277c34b2f1e67ea5a5d029a36e
- ページ
- /shindan/mihon/hiyori
- 写した要素
- .hy-hero
- 元のファイル
- src/scripts/shindan/mihon/hiyori/hero.ts
- src/scripts/shindan/mihon/hiyori/reveal.ts(initScrollLinks だけを呼ぶ)
- src/scripts/shindan/mihon/hiyori/motion.ts
- src/styles/mihon/hiyori.css
- src/styles/mihon/hiyori-home.css
- src/styles/mihon/_base.css
- src/pages/shindan/mihon/hiyori/index.astro・src/components/hiyori/FindBar.astro・Mark.astro(節のマークアップはサーバーの HTML から)
- 指示書
- prompts/hiyori.md
- 写したモジュール
- 吸収元と同じ中身(blob で照合)
権利と書き出し
- コード
- 便利DEネットの自社制作(見本サイトのために書いたコード)
- 字体
- OFL(fontsource のパッケージから読む。字体ファイルは持ち込まない)
- 素材
- 架空の介護グループの見本のために GPT で生成した写真 1 枚(高齢の女性と職員。人物の生成は事業者の指示書で hiyori だけに認められたもの)。実在の施設・人物・実績ではない
- 参考
- 参考サイト (参考サイト)((参考サイト))の録画から起こした指示書の寸法で作った版(事業者が 2026-12-04 06:06 に『全く一緒』と述べた、独自性の作り替え 0249975 の前の版 1d0bdd6)。参考の写真・文章・字体・コードは持ち込んでいない
- 書き出し
- code-restyle(コード 可・素材 不可・文 不可)
- 写真・見出し・導入文・検索の項目は案件のものに差し替える。見本の写真は架空の介護グループのために生成した人物写真なので、書き出さない
- 参考サイトの完全再現として作った版なので、色・字体・割り付け(外側 / 大きな写真 / 本文の 3 つの幅、検索のカプセルの形、弧の色と形)は案件のアートディレクションで決め直し、動きの仕組み(下から開く窓・スクロールで外側の幅まで広がる切り抜き・時刻で引かれる線)だけを使う
- ブランドムービー(<video data-hy-video>)を置けば、映像の自動再生・画面外と省データで止める・一時停止のボタン・映像の時刻に合わせた弧が hero.ts でそのまま動く。この見本の版は映像が未生成で、静止画(data-hy-video-missing)だけで確かめた
変えてよいところ
- 写真・映像:markup の [data-hy-hero=media] の中。<img data-hy-video-missing> か <video data-hy-video>(ポスターと source)
- 文:[data-hy-hero=title] の見出し・[data-hy-hero=lead] の導入文・[data-hy-hero=btn] のボタン
- 3 つの幅:.hy の --shell(外側=広がりきった幅)・--media(開いたときの写真の幅)・--content(本文)。1440・1179・767px で替わる
- 広がる距離:js/hero.ts の end: max(200, innerHeight × 0.6) と scrub 0.55(書き換えるときは technique の changes に理由を書く)
- 角丸:js/hero.ts の r0 = min(56, max(20, 画面の幅 × 0.022)) px と広がったときの 1.14 倍
- 弧の色と形:svg[data-hy-arcs] の path(stroke の色、d)。区間は js/hero.ts の win(24 秒の周期)
- 色・字体:.hy の --surface・--bg・--ink・--line と --sans(Geist+Noto Sans JP)。窓の地 .hy-hero__clip の #C9D3CA
変えてはいけないところ
- 窓は clip-path の inset(左右 --hx・角丸 --hr)で切り抜く。拡大縮小やフェードに置き換えない
- 入場の順と時刻:見出し 0.1 秒 → 窓 0.28 秒 → 導入文 0.22 秒 → ボタン 0.3 秒 → 検索 0.65 秒。窓は 1.2 秒 hy.out、写真は 1.08 → 1 を 1.4 秒
- 広がりはページの頭から 60vh(最低 200px)の scrub 0.55。戻すと元の幅へ戻る
- 写真の視差は yPercent 0 → 6(枠が画面の頭から抜けるまで)
- 弧は 3 本が別々の区間で引かれて消える(同時に全部を出さない)。画面外・タブが隠れている間は計算しない
- 検索のカプセルは窓の下端に重ね(1023px 以下は窓のすぐ下)、窓と一緒に開かない(遅れて上がる)
組み合わせ・品質
- 業種
- 介護・福祉・医療・企業・宿泊・おもてなし・業種を問わない
- AD
- ad-hiyori
- 合う
- 浮くカプセルのヘッダー(冒頭の上の余白はその分を空けてある)/冒頭の直後に、文と写真の節(私たちについてなど)
- 避ける
- 同じページの冒頭にもう 1 つ全幅の映像・スライドを置く/冒頭の上に別の固定の幕を重ねる(入場の時刻が見えなくなる)
- 注意
- 広がりの ScrollTrigger は start: 0(ページの頭)から測るので、ページの最初の節として置く。html・body・* に効く初期化の規則(_base.css)と、body の class="hy hy--home" に置いた変数を含む。Lenis はページ全体のスクロールを替える
- 依存
- gsap 3.15.1gsap/ScrollTrigger 3.15.1gsap/CustomEase 3.15.1(hy.out = 0.19,1,0.22,1 / hy.soft = 0.22,1,0.36,1)gsap/Flip 3.15.1(motion.ts が登録だけする。この節では使わない)lenis 1.3.27(PC だけ。lerp 0.1)@fontsource-variable/geist 5.3.0@fontsource-variable/noto-sans-jp 5.3.1
- 速さ
- 写真 1 枚(v01-1440.webp・fetchpriority=high)。映像を置くときは PC 用とスマホ用(767px 以下)の source を分ける/clip-path(窓の入場 1 回)と CSS 変数 --hx・--hr(スクロール)、transform(scale・yPercent)。弧は gsap.ticker で stroke-dashoffset と opacity を毎コマ書く(画面外では止める)/冒頭の入場は読み込みの直後に 1 回だけ
- レスポンシブ
- 1440px(幅の変数)/1179px(見出しとボタンを縦に)/1023px(検索のカプセルを窓の下へ・2 列)/767px(窓を 4:5 に、上の余白をヘッダーに合わせる、検索は 1 列)
- アクセシビリティ
- section に見出しの aria-labelledby。弧の svg と大きな印は aria-hidden。検索は form role=search と aria-label/↓ はページ内リンク(ヘッダーの下に止まり、0.7 秒後に行き先へフォーカス)。映像があるときは一時停止のボタン(aria-pressed と aria-label が替わる)/.hy :focus-visible に 2px の線。検索の欄はフォーカスで地が替わる(:focus-within)/検索の欄の select は見た目の行の高さのまま押せる高さ 44px
- 動きを減らす
- 見本の決まり:サイトの「動き:オフ」(html.reduced)のときだけ止める(motion.ts の reduced() は html.reduced だけを見る)。OS の「動きを減らす」では止めない(事業者の決まり 2026-11-30。吸収元の指示書 32-8 は OS に従うことを求めており、事業者の確認待ち)/入場・広がり・視差・弧はすべて動かさず、最初から開いた窓(左右は大きな写真の幅)と文を見せる。映像は自動で再生しない(ボタンで再生)。Lenis は作らない
- 素材
- 1 ファイル(案件には書き出さない)
ソース
/**
* 技術 hy-hero-unveil の入口(ライブデモ・案件の組み立てから mount を呼ぶ)
* 吸収元:ひよりケアグループ(APPROVED 1d0bdd6)の src/scripts/shindan/mihon/hiyori/index.ts のうち、この節に効く部分だけを同じ順で呼ぶ
* initScroll()(PC の Lenis)→ initHero() → initScrollLinks()(↓ のページ内の移動)→ 字体の到着・load で ScrollTrigger.refresh()
* 写したモジュール(js/ の中)は書き換えていない。
* 吸収元の initForms(検索のカプセルを施設の一覧へ移す)と initFilm(「ブランドムービーを見る」のモーダル)は、
* 別の部品なので写していない。デモでは検索のカプセルの送信だけを止める(下の noSubmit。外へは送らない)
*/
import '@fontsource-variable/geist/wght.css';
import '@fontsource-variable/noto-sans-jp/wght.css';
import './style.css';
import { gsap, ScrollTrigger, initScroll, lenis } from './js/motion';
import { initHero } from './js/hero';
import { initScrollLinks } from './js/reveal';
export const id = 'hy-hero-unveil';
/** 節を動かす。吸収元はページの読み込み直しで片付ける作りなので、後片付けはこの入口で ScrollTrigger・GSAP の動き・Lenis をまとめて止める */
export function mount(): () => void {
// 検索のカプセル([data-hy-find])は吸収元では initForms が受け取って施設の一覧へ移る。この技術には一覧がないので、送らずに止める
const noSubmit = (e: Event) => { if ((e.target as Element | null)?.matches?.('[data-hy-find]')) e.preventDefault(); };
window.addEventListener('submit', noSubmit, true);
initScroll();
initHero();
initScrollLinks();
let alive = true;
document.fonts?.ready.then(() => { if (alive) ScrollTrigger.refresh(); });
// 吸収元は load の前に入口が動く。デモは load の後に読み込むことがあるので、そのときはすぐ測り直す
const onLoad = () => ScrollTrigger.refresh();
if (document.readyState === 'complete') onLoad();
else window.addEventListener('load', onLoad, { once: true });
return () => {
alive = false;
window.removeEventListener('submit', noSubmit, true);
window.removeEventListener('load', onLoad);
ScrollTrigger.getAll().forEach((t) => t.kill());
gsap.globalTimeline.clear();
lenis?.destroy();
document.documentElement.classList.remove('hy-lenis');
};
}
<div class="hy-sheet">
<main id="hy-main">
<section class="hy-hero" aria-labelledby="hy-hero-h"><svg class="hy-bigmark hy-hero__curve" viewBox="0 0 1000 1000" aria-hidden="true" focusable="false"><g transform="translate(520 930)"><path d="M0 0C-330-235-372-662-26-970 318-672 298-245 0 0Z" transform="rotate(-24)"></path><path d="M0 0C-262-188-296-526-20-772 254-534 238-196 0 0Z" transform="rotate(30)"></path></g></svg><div class="hy-content hy-hero__head"><div class="hy-hero__txt"><h1 class="hy-h1" id="hy-hero-h" data-hy-hero="title">あなたらしい毎日を、ずっと。</h1><p class="hy-lead hy-hero__lead" data-hy-hero="lead">介護から在宅生活、リハビリまで。<br>一人ひとりの暮らしに寄り添うケアを届けます。</p></div><div class="hy-hero__btns" data-hy-hero="btn"><button class="hy-btn hy-btn--white" type="button" data-hy-film-open="" aria-haspopup="dialog"><svg class="hy-i" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6.5h16v11H4zM10 9.4v5.2l4.4-2.6L10 9.4Z"></path></svg><span>ブランドムービーを見る</span></button><a class="hy-circle" href="#hy-about" aria-label="私たちについてへ進む" data-hy-scroll=""><svg class="hy-i" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4.5V19M6.5 13.5 12 19l5.5-5.5"></path></svg></a></div></div><div class="hy-hero__stage" data-hy-stage=""><div class="hy-hero__clip" data-hy-clip=""><div class="hy-hero__media" data-hy-hero="media"><img class="hy-hero__video" src="{{asset:v01-1440.webp}}" width="1440" height="960" alt="デイサービスの明るい部屋で、高齢の女性と職員がテーブルをはさんで話している" fetchpriority="high" data-hy-video-missing=""></div><svg class="hy-hero__arcs" viewBox="0 0 1600 900" preserveAspectRatio="xMidYMid slice" aria-hidden="true" data-hy-arcs=""><path data-arc="0" d="M1640 160C1380 120 1160 260 1080 520 1030 690 1060 820 1110 940" stroke="#458743"></path><path data-arc="1" d="M-60 720C140 560 380 520 600 610" stroke="#E2B42A"></path><path data-arc="2" d="M1660 760C1470 640 1320 660 1210 760" stroke="#398EAA"></path></svg><div class="hy-hero__ctrl"><button class="hy-circle hy-circle--sm hy-circle--glass" type="button" aria-label="ブランドムービーを一時停止" aria-pressed="false" data-hy-video-toggle="" hidden=""><svg class="hy-i" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M8.5 5.5v13M15.5 5.5v13"></path></svg></button></div></div><div class="hy-hero__find" data-sec="map" data-hy-findwrap=""><form class="hy-find" action="/shindan/mihon/hiyori/facilities" method="get" role="search" aria-label="サービス・施設を探す" data-hy-find=""><span class="hy-find__mag" aria-hidden="true"><svg class="hy-i" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M10.6 17.2a6.6 6.6 0 1 0 0-13.2 6.6 6.6 0 0 0 0 13.2ZM15.4 15.4 20 20"></path></svg></span><label class="hy-find__f"><span class="hy-find__k">お探しのサービス</span><span class="hy-find__v"><select name="svc" id="hy-find-svc"><option value="" selected="">すべてのサービス</option><option value="nursing-home">高齢者介護施設</option><option value="home-care">訪問介護</option><option value="day-service">デイサービス</option><option value="visiting-nurse">訪問看護・リハビリ</option><option value="disability">障害福祉サービス</option><option value="equipment">福祉用具・生活支援</option></select><svg class="hy-i hy-find__chev" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4.5V19M6.5 13.5 12 19l5.5-5.5"></path></svg></span></label><label class="hy-find__f"><span class="hy-find__k">お住まいの地域</span><span class="hy-find__v"><select name="area" id="hy-find-area"><option value="" selected="">すべての地域</option><option value="east">東エリア</option><option value="central">中央エリア</option><option value="north">北エリア</option><option value="south">南エリア</option><option value="west">西エリア</option></select><svg class="hy-i hy-find__chev" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4.5V19M6.5 13.5 12 19l5.5-5.5"></path></svg></span></label><label class="hy-find__f"><span class="hy-find__k">対応エリア</span><span class="hy-find__v"><select name="scope" id="hy-find-scope"><option value="" selected="">通う・訪問のどちらも</option><option value="stay">通う・住む</option><option value="visit">ご自宅に伺う</option></select><svg class="hy-i hy-find__chev" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M12 4.5V19M6.5 13.5 12 19l5.5-5.5"></path></svg></span></label><button class="hy-btn hy-btn--ink hy-find__go" type="submit"><span>サービスを探す</span><svg class="hy-i" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 12h14.5M13.5 6.5 19 12l-5.5 5.5"></path></svg></button></form></div></div></section>
</main>
</div>
/* ひよりケアグループ(HIYORI CARE)(1d0bdd6)/shindan/mihon/hiyori の .hy-hero に当たる規則を、吸収元のページの CSSOM で選び、元のスタイルの原文のまま写したもの。書き換えない。 */
/* --- src/styles/mihon/hiyori.css */
.hy {
/* 補助文字は指示書 5 章の #758188 だと灰緑の地で 3.65:1 になり、33 章の「コントラストを確保する」と合わないので、4.5:1 を超える #646F76 に下げた */
--bg: #F3F5F2; --surface: #FFFFFC; --ink: #1B2124; --head: #101414; --body: #626E75; --sub: #646F76;
--line: #DCE2DE; --mint: #E6EFE3; --forest: #254C27;
/* 3 種類の幅(6-1):外側・大きな写真・本文 */
--shell: min(75.5vw, 1920px); --media: min(72.5vw, 1848px); --content: min(53.5vw, 1360px);
--gut: clamp(10px, 0.94vw, 24px);
--hd-h: clamp(56px, 3.125vw, 80px); --hd-top: 16px;
--ease: cubic-bezier(0.19, 1, 0.22, 1); --ease2: cubic-bezier(0.22, 1, 0.36, 1); --p2: cubic-bezier(0.33, 1, 0.68, 1);
--sans: 'Geist Variable', 'Noto Sans JP Variable', 'Hiragino Sans', 'Yu Gothic UI', system-ui, sans-serif;
margin: 0; background: var(--surface); color: var(--ink); font-family: var(--sans);
font-size: clamp(16px, 0.78vw, 20px); line-height: 1.8; letter-spacing: 0.01em; font-feature-settings: 'palt' 0;
font-optical-sizing: auto;
}
@media (max-width: 1440px) {
.hy { --shell: 88vw; --media: 85vw; --content: 68vw; }
}
@media (max-width: 1179px) {
.hy { --shell: 92vw; --media: 92vw; --content: 84vw; }
}
@media (max-width: 767px) {
.hy { --shell: calc(100vw - 24px); --media: calc(100vw - 32px); --content: calc(100vw - 44px); --hd-h: 56px; --hd-top: 10px; font-size: 16px; }
}
html.hy-lenis, html.hy-lenis.js:not(.reduced) { scroll-behavior: auto !important; }
html:has(body.hy) { scrollbar-gutter: stable; }
html.hy-locked { overflow: hidden; }
html.js:not(.reduced) .hy :is([data-hy-in]:not([data-hy-in='photo']), [data-hy-head], [data-hy-hero='title'], [data-hy-hero='lead'], [data-hy-hero='btn'], [data-hy-findwrap], .hy-hd .hy-cap):not(.is-in) {
visibility: hidden; animation: hy-failsafe 0s 2.5s forwards;
}
.hy ::selection { background: #254C27; color: #fff; }
.hy a { text-decoration: none; }
.hy :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
.hy-sheet {
position: relative; margin: 0 var(--gut); background: var(--bg);
border-radius: 0 0 clamp(36px, 3vw, 64px) clamp(36px, 3vw, 64px);
}
.hy-sheet > main { display: block; outline: none; }
.hy-content { width: var(--content); margin-inline: auto; }
.hy-h1, .hy-h1s, .hy-h2x, .hy-h2, .hy-h3 { margin: 0; color: var(--head); font-weight: 450; font-feature-settings: 'palt' 1; letter-spacing: 0.01em; }
.hy-h1 { font-size: clamp(38px, 3.05vw, 78px); line-height: 1.22; }
.hy-lead { color: var(--body); line-height: 1.85; max-width: 38em; }
.hy-h1, .hy-h1s, .hy-h2x, .hy-h2, .hy-h3, .hy-lead { word-break: auto-phrase; text-wrap: pretty; }
@media (max-width: 767px) {
.hy-h1 { font-size: clamp(34px, 9.6vw, 42px); }
}
.hy-btn {
--h: clamp(48px, 2.7vw, 64px);
position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px; height: var(--h); padding: 0 clamp(22px, 1.4vw, 32px);
border: 1px solid transparent; border-radius: 999px; font: 500 clamp(14px, 0.66vw, 16px)/1 var(--sans); letter-spacing: 0.04em; white-space: nowrap; cursor: pointer;
transition: background-color 0.3s var(--p2), border-color 0.3s var(--p2), color 0.3s var(--p2), transform 0.3s var(--p2);
}
.hy-btn .hy-i { width: 18px; height: 18px; transition: transform 0.3s var(--p2); }
.hy-btn:hover .hy-i { transform: translateX(4px); }
.hy-btn--ink { background: var(--ink); color: #fff; }
.hy-btn--ink:hover { background: #2B3437; }
.hy-btn--white { background: var(--surface); color: var(--ink); border-color: var(--line); }
.hy-btn--white:hover { border-color: #C3CDC7; background: #fff; }
.hy-btn:active { transform: scale(0.985); }
.hy-circle {
display: inline-grid; place-items: center; width: clamp(52px, 2.5vw, 64px); height: clamp(52px, 2.5vw, 64px); border: 0; border-radius: 50%;
background: var(--ink); color: #fff; cursor: pointer; transition: background-color 0.3s var(--p2), transform 0.3s var(--p2);
}
.hy-circle .hy-i { width: 20px; height: 20px; transition: transform 0.3s var(--p2); }
.hy-circle:hover { background: #2B3437; }
.hy-circle:hover .hy-i { transform: translateY(3px); }
.hy-circle--sm { width: 44px; height: 44px; }
.hy-circle--sm .hy-i { width: 18px; height: 18px; }
.hy-circle--glass { background: rgba(255, 255, 252, 0.18); color: #fff; border: 1px solid rgba(255, 255, 252, 0.45); backdrop-filter: blur(6px); }
.hy-i { display: block; flex: none; width: 20px; height: 20px; }
/* --- src/styles/mihon/hiyori-home.css */
.hy-hero { position: relative; padding-top: clamp(150px, 9vw, 236px); overflow-x: clip; }
.hy-hero__curve { position: absolute; right: -7vw; top: -6vw; width: min(64vw, 1640px); height: auto; fill: #254C27; opacity: 0.045; pointer-events: none; }
.hy-hero__head { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; }
.hy-hero__lead { margin-top: clamp(16px, 1.1vw, 28px); max-width: 680px; }
.hy-hero__btns { display: flex; align-items: center; gap: 11px; flex: none; }
.hy-hero__btns .hy-btn .hy-i { width: 20px; height: 20px; }
.hy-hero__btns .hy-btn:hover .hy-i { transform: none; }
.hy-hero__stage {
--hx: calc((var(--shell) - var(--media)) / 2); --hr: clamp(28px, 2.2vw, 56px);
position: relative; width: var(--shell); height: calc(var(--media) * 9 / 16); margin: clamp(48px, 2.9vw, 76px) auto 0;
}
.hy-hero__clip { position: absolute; inset: 0; overflow: hidden; clip-path: inset(0 var(--hx) round var(--hr)); background: #C9D3CA; }
.hy-hero__media { position: absolute; inset: 0; transform-origin: 50% 50%; }
.hy-hero__video { display: block; width: 100%; height: 100%; object-fit: cover; }
.hy-hero__arcs { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke-width: 30; stroke-linecap: round; pointer-events: none; }
.hy-hero__arcs path { opacity: 0; }
.hy-hero__ctrl { position: absolute; right: calc(var(--hx) + 20px); top: 20px; z-index: 2; }
.hy-hero__find { position: absolute; left: calc(var(--hx) + 20px); right: calc(var(--hx) + 20px); bottom: 20px; z-index: 3; }
@media (max-width: 1179px) {
.hy-hero__head { flex-direction: column; align-items: flex-start; gap: 26px; }
}
@media (max-width: 1023px) {
.hy-hero__stage { height: auto; }
.hy-hero__clip { position: relative; inset: auto; height: calc(var(--media) * 9 / 16); }
.hy-hero__find { position: relative; left: auto; right: auto; bottom: auto; width: var(--media); margin: -34px auto 0; }
.hy-hero__ctrl { right: calc(var(--hx) + 14px); top: 14px; }
}
@media (max-width: 767px) {
.hy-hero { padding-top: calc(var(--hd-top) + var(--hd-h) + 56px); }
.hy-hero__curve { width: 140vw; right: -40vw; top: -10vw; }
.hy-hero__btns .hy-btn { --h: 52px; }
.hy-hero__stage { margin-top: 32px; }
.hy-hero__clip { height: calc(var(--media) * 5 / 4); }
.hy-hero__find { margin-top: -26px; width: calc(var(--media) - 20px); }
}
.hy-find {
display: grid; grid-template-columns: auto 1fr 1fr 1fr auto; align-items: center; height: clamp(76px, 4.4vw, 100px); padding: 9px 9px 9px 10px;
border-radius: 999px; background: var(--surface); box-shadow: 0 22px 50px -32px rgba(16, 20, 20, 0.55);
}
.hy-find__mag { display: grid; place-items: center; width: clamp(56px, 3.3vw, 80px); height: clamp(56px, 3.3vw, 80px); border-radius: 50%; background: var(--bg); color: var(--ink); }
.hy-find__mag .hy-i { width: 22px; height: 22px; }
.hy-find__f { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 2px; height: 62%; padding: 0 clamp(16px, 1.4vw, 34px); border-left: 1px solid var(--line); cursor: pointer; }
.hy-find__mag + .hy-find__f { border-left: 0; }
.hy-find__k { color: var(--sub); font-size: 12.5px; line-height: 1.3; letter-spacing: 0.04em; }
.hy-find__v { position: relative; display: block; }
.hy-find select { appearance: none; -webkit-appearance: none; width: 100%; min-height: 44px; margin-block: -7px; padding: 2px 30px 2px 0; border: 0; background: none; color: var(--ink); font: 500 clamp(15px, 0.8vw, 19px)/1.4 var(--sans); cursor: pointer; text-overflow: ellipsis; }
.hy-find select:focus { outline: none; }
.hy-find__f:focus-within { background: var(--bg); border-radius: 999px; border-left-color: transparent; }
.hy-find__f:focus-within + .hy-find__f { border-left-color: transparent; }
.hy-find__chev { position: absolute; right: 2px; top: 50%; width: 16px; height: 16px; margin-top: -8px; pointer-events: none; color: var(--body); }
.hy-find__go { --h: 100%; padding: 0 clamp(24px, 1.8vw, 40px); }
@media (max-width: 1023px) {
.hy-find, .hy-find--compact { grid-template-columns: 1fr 1fr; height: auto; gap: 6px; padding: 14px; border-radius: 28px; }
.hy-find__mag { display: none; }
.hy-find__f { height: 66px; padding: 0 18px; border: 1px solid var(--line); border-radius: 18px; }
.hy-find__mag + .hy-find__f { border-left: 1px solid var(--line); }
.hy-find__f:focus-within { border-radius: 18px; border-color: var(--ink); }
.hy-find__go { --h: 58px; grid-column: 1 / -1; width: 100%; }
}
@media (min-width: 768px) and (max-width: 1023px) {
.hy-find:not(.hy-find--compact) .hy-find__go { --h: 66px; grid-column: auto; }
}
@media (max-width: 767px) {
.hy-find, .hy-find--compact { grid-template-columns: 1fr; }
}
/* --- src/styles/mihon/_base.css */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.js:not(.reduced) { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; overflow-wrap: anywhere; -webkit-font-smoothing: antialiased; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
/* --- @keyframes */
@keyframes hy-failsafe { to { visibility: visible; } }
/**
* トップの冒頭(指示書 9〜10 章)
* ・入場(9-5):見出しが下の窓から立ち上がる(0.9s hy.soft)→ 説明(+0.12s)→ ボタン(+0.2s)→ 写真の枠が下から開き、中の映像は 1.08 → 1(1.4s hy.out)
* → 検索のカプセルが y 18 → 0(+0.55s)
* ・スクロール(9-6):映像の切り抜きが「大きな写真の幅」から「外側の幅」まで広がる(scrub 0.55)。角丸は少し大きく
* ・映像(10 章):音なしで自動再生。再生できないとき・省データ設定のときはポスターのまま、ボタンで再生。画面外・タブ非表示で止める
* ・ブランドの弧(10-4):映像の時刻に合わせて、3 本の色の線が引かれて消える(映像がないときは 24 秒の時計で)
*/
import { gsap, ScrollTrigger, reduced, icon } from './motion';
export function initHero() {
const hero = document.querySelector<HTMLElement>('.hy-hero');
if (!hero) return;
const R = reduced();
const q = <T extends HTMLElement = HTMLElement>(s: string) => hero.querySelector<T>(s);
const title = q('[data-hy-hero="title"]'), lead = q('[data-hy-hero="lead"]'), btn = q('[data-hy-hero="btn"]');
const stage = q('[data-hy-stage]'), clip = q('[data-hy-clip]'), media = q('[data-hy-hero="media"]');
const find = q('[data-hy-findwrap]');
const video = q<HTMLVideoElement>('[data-hy-video]');
const toggle = q<HTMLButtonElement>('[data-hy-video-toggle]');
if (!stage || !clip || !media) return;
/* 切り抜きの幅:外側の幅(stage)と大きな写真の幅(--media)の差の半分 */
const probe = document.createElement('span');
probe.style.cssText = 'position:absolute;left:0;top:0;width:var(--media);height:0;visibility:hidden;pointer-events:none';
stage.append(probe);
const hx0 = () => Math.max(0, (stage.offsetWidth - probe.offsetWidth) / 2);
const r0 = () => Math.min(56, Math.max(20, window.innerWidth * 0.022));
const setClip = (p: number) => {
stage.style.setProperty('--hx', `${(hx0() * (1 - p)).toFixed(2)}px`);
stage.style.setProperty('--hr', `${(r0() * (1 + 0.14 * p)).toFixed(2)}px`);
};
setClip(0);
/* 入場 */
if (!R) {
const tl = gsap.timeline({ delay: 0.1 });
if (title) tl.fromTo(title, { yPercent: 40, autoAlpha: 0, clipPath: 'inset(0% 0% 100% 0%)' }, { yPercent: 0, autoAlpha: 1, clipPath: 'inset(0% 0% -20% 0%)', duration: 0.95, ease: 'hy.soft', clearProps: 'clipPath' }, 0);
if (lead) tl.fromTo(lead, { y: 18, autoAlpha: 0 }, { y: 0, autoAlpha: 1, duration: 0.8, ease: 'hy.soft' }, 0.12);
if (btn) tl.fromTo(btn, { y: 14, autoAlpha: 0 }, { y: 0, autoAlpha: 1, duration: 0.7, ease: 'hy.soft' }, 0.2);
tl.fromTo(clip, { clipPath: () => `inset(16% ${hx0()}px 0% ${hx0()}px round ${r0()}px)` }, { clipPath: () => `inset(0% ${hx0()}px 0% ${hx0()}px round ${r0()}px)`, duration: 1.2, ease: 'hy.out', clearProps: 'clipPath' }, 0.18)
.fromTo(media, { scale: 1.08 }, { scale: 1, duration: 1.4, ease: 'hy.out' }, 0.18);
if (find) tl.fromTo(find, { y: 18, autoAlpha: 0 }, { y: 0, autoAlpha: 1, duration: 0.7, ease: 'hy.soft', clearProps: 'transform' }, 0.55);
}
[title, lead, btn, find].forEach((el) => el?.classList.add('is-in'));
/* スクロールで広がる(入場の後で効かせる) */
if (!R) {
ScrollTrigger.create({
start: 0, end: () => Math.max(200, window.innerHeight * 0.6),
scrub: 0.55,
onUpdate: (st) => setClip(st.progress),
onRefresh: (st) => setClip(st.progress),
});
gsap.to(media, { yPercent: 6, ease: 'none', scrollTrigger: { trigger: stage, start: 'top top', end: 'bottom top', scrub: true } });
}
/* 映像 */
const saveData = !!(navigator as Navigator & { connection?: { saveData?: boolean } }).connection?.saveData;
let wantPlay = !R && !saveData;
let inView = true;
const setBtn = (playing: boolean) => {
if (!toggle) return;
toggle.innerHTML = icon(playing ? 'pause' : 'play');
toggle.setAttribute('aria-label', playing ? 'ブランドムービーを一時停止' : 'ブランドムービーを再生');
toggle.setAttribute('aria-pressed', String(!playing));
};
if (video && toggle) {
toggle.hidden = false;
const tryPlay = () => {
if (!wantPlay || !inView || document.hidden) { video.pause(); return; }
video.play().catch(() => { wantPlay = false; setBtn(false); });
};
video.addEventListener('play', () => setBtn(true));
video.addEventListener('pause', () => setBtn(false));
toggle.addEventListener('click', () => { wantPlay = video.paused; if (wantPlay) tryPlay(); else video.pause(); });
new IntersectionObserver((es) => { inView = es[0].isIntersecting; tryPlay(); }, { threshold: 0.05 }).observe(stage);
document.addEventListener('visibilitychange', tryPlay);
setBtn(false);
if (R || saveData) video.removeAttribute('autoplay');
tryPlay();
}
/* ブランドの弧 */
const arcs = [...hero.querySelectorAll<SVGPathElement>('[data-arc]')];
if (R || !arcs.length) return;
const DUR = 24;
const win = [[0.5, 4.3], [7.9, 11.6], [15.5, 19.2]];
const lens = arcs.map((p) => p.getTotalLength());
arcs.forEach((p, i) => { p.style.strokeDasharray = `${lens[i]}`; p.style.strokeDashoffset = `${lens[i]}`; });
const t0 = performance.now();
let visible = true;
new IntersectionObserver((es) => { visible = es[0].isIntersecting; }).observe(stage);
gsap.ticker.add(() => {
if (!visible || document.hidden) return;
const t = video && video.duration ? video.currentTime % video.duration : ((performance.now() - t0) / 1000) % DUR;
arcs.forEach((p, i) => {
const [a, b] = win[i];
let draw = 0, op = 0;
if (t >= a && t <= b) {
draw = Math.min(1, (t - a) / 1.3);
draw = 1 - Math.pow(1 - draw, 3);
op = t > b - 0.7 ? Math.max(0, (b - t) / 0.7) : 1;
}
p.style.strokeDashoffset = `${lens[i] * (1 - draw)}`;
p.style.opacity = `${op * 0.9}`;
});
});
}
/**
* ひよりケアの見本の動きの共通:GSAP の登録・イージング・「動き:オフ」の判定・なめらかなスクロール(Lenis)・スクロールの固定
* 指示書 31 章のイージング:
* hy.out (0.19,1,0.22,1) … 現れる・開く(メガメニュー・写真・カード)
* hy.soft (0.22,1,0.36,1) … 文字の立ち上がり・小さな移動
* hy.io (0.76,0,0.24,1) … 切り替え(スライダーのマスク・写真の入れ替え)
* hy.p2 (0.33,1,0.68,1) … ボタン・ナビの細かな反応(CSS の --p2 と同じ)
*/
import { gsap } from 'gsap';
import { ScrollTrigger } from 'gsap/ScrollTrigger';
import { Flip } from 'gsap/Flip';
import { CustomEase } from 'gsap/CustomEase';
import Lenis from 'lenis';
gsap.registerPlugin(ScrollTrigger, Flip, CustomEase);
CustomEase.create('hy.out', '0.19,1,0.22,1');
CustomEase.create('hy.soft', '0.22,1,0.36,1');
CustomEase.create('hy.io', '0.76,0,0.24,1');
CustomEase.create('hy.p2', '0.33,1,0.68,1');
export { gsap, ScrollTrigger, Flip };
export const root = document.documentElement;
/** 便利DEネットの「動き:オフ」だけで止める(OS の「動きを減らす」では止めない。2026-11-30 事業者の指示。見本はすべて同じ) */
export const reduced = () => root.classList.contains('reduced');
/** マウスで細かく指せる端末(ホバーでメガメニューを開くかどうか) */
export const fine = () => window.matchMedia('(hover: hover) and (pointer: fine)').matches;
/** 指で触る端末(Lenis を作らない。便利DEネット本体の軽さの決まりと同じ) */
export const touch = () => window.matchMedia('(hover: none), (pointer: coarse)').matches;
export const desktopNav = () => window.matchMedia('(min-width: 1180px)').matches;
export let lenis: Lenis | null = null;
export function initScroll() {
if (reduced() || touch()) return;
lenis = new Lenis({ lerp: 0.1, wheelMultiplier: 1, smoothWheel: true, anchors: false });
root.classList.add('hy-lenis');
lenis.on('scroll', ScrollTrigger.update);
gsap.ticker.add((t) => lenis?.raf(t * 1000));
gsap.ticker.lagSmoothing(0);
}
/** ヘッダーの下端(固定のカプセル)。ページ内の移動はこの分だけ手前で止める */
export const headerBottom = () => {
const hd = document.querySelector<HTMLElement>('[data-hy-hd-main]');
return hd ? hd.getBoundingClientRect().bottom + 16 : 90;
};
/** ページ内の移動(Lenis があればそれで、なければふつうのスクロール) */
export function scrollToEl(el: Element | null, opts: { offset?: number } = {}) {
if (!el) return;
const off = opts.offset ?? -headerBottom();
// 行き先はブラウザの実際の位置から計算する。一覧が短くなった直後は、ブラウザが位置を下端に詰めても Lenis の内側の値が古いままで、
// 要素を渡すと行き先が下へずれる(お知らせの 2 ページ目で、一覧の頭ではなくページの下端へ行っていた)
const y = el.getBoundingClientRect().top + window.scrollY + off;
if (lenis) { lenis.resize(); lenis.scrollTo(Math.max(0, y), { duration: 1.15 }); return; }
window.scrollTo({ top: y, behavior: reduced() ? 'auto' : 'smooth' });
}
/** メニュー・検索・動画を開いている間は、うしろの面をスクロールさせない(重ねて開いても数で管理する) */
let locks = 0;
export function lockScroll(on: boolean) {
locks = Math.max(0, locks + (on ? 1 : -1));
const lock = locks > 0;
// Lenis があるときは Lenis を止めるだけ(overflow: hidden にするとスクロールバーの溝が白い帯で残る)
if (lenis) { if (lock) lenis.stop(); else lenis.start(); }
else root.classList.toggle('hy-locked', lock);
}
/** 間引いた refresh(節の出し入れ・字体の到着・画像の読み込みで何度も呼ばれる) */
let rt = 0;
export const refreshSoon = (ms = 120) => { clearTimeout(rt); rt = window.setTimeout(() => ScrollTrigger.refresh(), ms); };
/** 開いている部品の外側をフォーカスで移れないようにする(モーダル用の最小のフォーカストラップ) */
export function trapFocus(box: HTMLElement, e: KeyboardEvent) {
if (e.key !== 'Tab') return;
const f = [...box.querySelectorAll<HTMLElement>('a[href], button:not([disabled]), input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])')].filter((x) => x.offsetParent !== null || x === document.activeElement);
if (!f.length) return;
const first = f[0], last = f[f.length - 1];
if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); }
else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); }
}
/** アイコンの svg(Icon.astro と同じ線)。JS で入れ替える再生・一時停止に使う */
const ICON: Record<string, string> = {
play: '<path d="M8 5.6v12.8L18.4 12 8 5.6Z" fill="currentColor" stroke="none"/>',
pause: '<path d="M8.5 5.5v13M15.5 5.5v13"/>',
close: '<path d="M6 6l12 12M18 6 6 18"/>',
arrow: '<path d="M4.5 12h14.5M13.5 6.5 19 12l-5.5 5.5"/>',
};
export const icon = (name: keyof typeof ICON) =>
`<svg class="hy-i" viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">${ICON[name]}</svg>`;
/**
* 現れる動き・視差・下層ページの入場・流れる帯・FAQ・ページ内の移動(指示書 31 章・17 章・24-2)
* [data-hy-in="text"] … 文のかたまり:y 26 → 0・透明 → 不透明(0.9s hy.soft)
* [data-hy-in="photo"] … 写真の枠:下から開く clip-path(1.1s hy.out)、中の写真は 1.08 → 1
* [data-hy-in="rise"] … カード:y 40 → 0(0.85s hy.soft)。--d で遅らせる
* [data-hy-in="label"] … 札:x -8 → 0、[data-hy-in="rule"] … 線:左から引く(scaleX 0 → 1)
* [data-hy-par="40"] … 写真の枠の中の画像を、通り過ぎる間に 40px 動かす(scrub)
* [data-hy-head] … 下層ページのタイトル:パンくず → 見出し → 説明 → ボタンの順に 0.08s ずつ(31-4)
* いずれも 1 度だけ(戻っても隠し直さない)。動き:オフでは最初から見せる(CSS でも隠さない)
*/
import { gsap, ScrollTrigger, reduced, scrollToEl } from './motion';
export function initReveal() {
const R = reduced();
const ins = [...document.querySelectorAll<HTMLElement>('[data-hy-in]')];
if (R) { ins.forEach((el) => el.classList.add('is-in')); return; }
const from: Record<string, gsap.TweenVars> = {
text: { y: 26, autoAlpha: 0 },
rise: { y: 40, autoAlpha: 0 },
label: { x: -8, autoAlpha: 0 },
rule: { scaleX: 0 },
};
ins.forEach((el) => {
const kind = el.dataset.hyIn ?? 'text';
const delay = parseFloat(getComputedStyle(el).getPropertyValue('--d')) || 0;
const st = { trigger: el, start: 'top 88%', once: true } as ScrollTrigger.Vars;
// CSS は JS が始めの形を置くまで隠しておく(.is-in で見せる。読み込みの途中に一瞬見えてから消えないように)
queueMicrotask(() => el.classList.add('is-in'));
if (kind === 'photo') {
const img = el.querySelector('img');
// 始めの形は CSS(hiyori.css)と同じ。始めと終わりを同じ書き方で渡す(計算後の値はブラウザが inset の 4 つの値を 3 つに縮めるので、
// 読み取った値から動かすと、GSAP が数字を位置で対応させて角の丸み 12px が途中で 0 に近づいていた)
const tl = gsap.timeline({ scrollTrigger: st, delay });
tl.fromTo(el, { clipPath: 'inset(14% 0% 0% 0% round 12px)' }, { clipPath: 'inset(0% 0% 0% 0% round 12px)', duration: 1.1, ease: 'hy.out', clearProps: 'clipPath', immediateRender: true }, 0);
if (img) tl.fromTo(img, { scale: 1.08 }, { scale: 1, duration: 1.4, ease: 'hy.out', clearProps: 'transform' }, 0);
return;
}
const f = from[kind] ?? from.text;
gsap.set(el, f);
gsap.to(el, {
...Object.fromEntries(Object.keys(f).map((k) => [k, k === 'autoAlpha' || k === 'scaleX' ? 1 : 0])),
duration: kind === 'rule' ? 1.1 : kind === 'rise' ? 0.85 : 0.9, ease: kind === 'rule' ? 'hy.out' : 'hy.soft', delay,
scrollTrigger: st, clearProps: 'transform',
});
});
// 視差:写真の枠(.hy-frame は中の画像を 112% の高さで持っている)
document.querySelectorAll<HTMLElement>('[data-hy-par]').forEach((el) => {
const pic = el.querySelector<HTMLElement>(':scope > .hy-pic') ?? el.querySelector<HTMLElement>('.hy-pic');
if (!pic) return;
const v = parseFloat(el.dataset.hyPar || '40') / 2;
gsap.fromTo(pic, { y: -v }, { y: v, ease: 'none', scrollTrigger: { trigger: el, start: 'top bottom', end: 'bottom top', scrub: true } });
});
}
/** 下層ページの入場(31-4) */
export function initPageHead() {
const els = [...document.querySelectorAll<HTMLElement>('[data-hy-head]')];
if (!els.length || reduced()) return;
const order = ['crumb', 'title', 'lead', 'btn'];
els.sort((a, b) => order.indexOf(a.dataset.hyHead!) - order.indexOf(b.dataset.hyHead!));
gsap.fromTo(els, { y: 22, autoAlpha: 0 }, { y: 0, autoAlpha: 1, duration: 0.85, ease: 'hy.soft', stagger: 0.08, delay: 0.08, clearProps: 'transform' });
els.forEach((el) => el.classList.add('is-in'));
}
/** 横に流れるブランドの帯(17 章):毎秒約 30px。画面外・タブ非表示・止めるボタンで止める */
export function initBand() {
document.querySelectorAll<HTMLElement>('[data-hy-band]').forEach((band) => {
const track = band.querySelector<HTMLElement>('[data-hy-band-track]');
const btn = band.querySelector<HTMLButtonElement>('[data-hy-band-pause]');
const grp = track?.firstElementChild as HTMLElement | null;
if (!track || !grp) return;
if (reduced()) { if (btn) btn.hidden = true; return; }
let x = 0, w = grp.offsetWidth, paused = false, visible = false;
new ResizeObserver(() => { w = grp.offsetWidth; }).observe(grp);
new IntersectionObserver((es) => { visible = es[0].isIntersecting; }).observe(band);
const setX = gsap.quickSetter(track, 'x', 'px');
gsap.ticker.add((_t, dt) => {
if (paused || !visible || document.hidden || !w) return;
x -= (30 * dt) / 1000;
if (x <= -w) x += w;
setX(x);
});
btn?.addEventListener('click', () => {
paused = !paused;
btn.setAttribute('aria-pressed', String(paused));
btn.setAttribute('aria-label', paused ? '帯の動きを再開する' : '帯の動きを止める');
btn.innerHTML = paused
? '<svg class="hy-i" viewBox="0 0 24 24" aria-hidden="true" fill="currentColor"><path d="M8 5.6v12.8L18.4 12 8 5.6Z"/></svg>'
: '<svg class="hy-i" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><path d="M8.5 5.5v13M15.5 5.5v13"/></svg>';
});
});
}
/** FAQ のアコーディオン(24-2):高さを 0.35s で開閉。aria-expanded と hidden を合わせる */
export function initFaq() {
document.querySelectorAll<HTMLButtonElement>('.hy-faq__q').forEach((q) => {
const a = document.getElementById(q.getAttribute('aria-controls') ?? '');
if (!a) return;
q.addEventListener('click', () => {
const v = q.getAttribute('aria-expanded') !== 'true';
q.setAttribute('aria-expanded', String(v));
if (reduced()) { a.hidden = !v; ScrollTrigger.refresh(); return; }
gsap.killTweensOf(a);
if (v) { a.hidden = false; gsap.fromTo(a, { height: 0 }, { height: 'auto', duration: 0.35, ease: 'hy.out', onComplete: () => { gsap.set(a, { clearProps: 'height' }); ScrollTrigger.refresh(); } }); }
else gsap.to(a, { height: 0, duration: 0.3, ease: 'hy.p2', onComplete: () => { a.hidden = true; gsap.set(a, { clearProps: 'height' }); ScrollTrigger.refresh(); } });
});
});
}
/** ページ内のリンク([data-hy-scroll]):ヘッダーの下で止まるように移る */
export function initScrollLinks() {
document.addEventListener('click', (e) => {
const a = (e.target as Element | null)?.closest<HTMLAnchorElement>('a[data-hy-scroll]');
if (!a) return;
const h = a.getAttribute('href') ?? '';
if (!h.startsWith('#') || h.length < 2) return;
const t = document.getElementById(decodeURIComponent(h.slice(1)));
if (!t) return;
e.preventDefault();
scrollToEl(t);
if (!t.hasAttribute('tabindex') && !/^(A|BUTTON|INPUT|SELECT|TEXTAREA)$/.test(t.tagName)) t.setAttribute('tabindex', '-1');
window.setTimeout(() => t.focus({ preventScroll: true }), reduced() ? 0 : 700);
});
}
# hy-hero-unveil — 下から開く写真の窓が、スクロールで外側の幅まで広がる冒頭
吸収元:ひよりケアグループ(HIYORI CARE)・APPROVED `1d0bdd6`・`/shindan/mihon/hiyori` の `.hy-hero`(「あなたらしい毎日を、ずっと。」)。
動きの仕様は吸収元の `docs/mihon-hiyori/MOTION_SPEC.md` の 2-5(M08〜M13)。
## 何をしているか
- **入場**(`hero.ts`・開いたとき 1 回。タイムラインの遅れ 0.1 秒)
- 見出し `[data-hy-hero=title]`:yPercent 40・透明・`clip-path: inset(0% 0% 100% 0%)` → 0・不透明・`inset(0% 0% -20% 0%)`、0.95 秒 hy.soft(`cubic-bezier(.22,1,.36,1)`)。終わったら clip-path を消す。
- 導入文:+0.12 秒、y 18 → 0・0.8 秒。ボタン:+0.2 秒、y 14 → 0・0.7 秒(どちらも hy.soft)。
- 写真の窓 `[data-hy-clip]`:+0.18 秒、`inset(16% hx 0% hx round r)` → `inset(0% hx 0% hx round r)`、1.2 秒 hy.out(`cubic-bezier(.19,1,.22,1)`)。中の写真 `[data-hy-hero=media]` は scale 1.08 → 1・1.4 秒 hy.out。
- 検索のカプセル `[data-hy-findwrap]`:+0.55 秒、y 18 → 0・0.7 秒 hy.soft。
- JS が動くまでは CSS が見出し・導入文・ボタン・検索を `visibility: hidden` にしておき、JS が動かなくても 2.5 秒で見せる(`hy-failsafe`)。
- **スクロールで広がる**:`hx0 = (外側の枠の幅 − --media の幅) / 2`、`r0 = min(56, max(20, 画面の幅 × 0.022))`。ページの頭から `max(200px, 60vh)` までの進み p(scrub 0.55)で `--hx = hx0 × (1 − p)`、`--hr = r0 × (1 + 0.14p)`。CSS の `clip-path: inset(0 var(--hx) round var(--hr))` が窓を切る。写真は枠が画面の頭から抜けるまで yPercent 0 → 6(scrub)。
- **ブランドの弧**:3 本の path の長さで dasharray を置き、`gsap.ticker` で毎コマ、時刻 t(映像があれば映像の時刻、なければ 24 秒の時計)が区間 [0.5, 4.3]・[7.9, 11.6]・[15.5, 19.2] に入った線だけを `1 − (1 − min(1, (t − 始め) / 1.3))³` まで引き、区間の最後の 0.7 秒で消す(不透明度 × 0.9)。窓が画面外・タブが隠れている間は計算しない。
- 映像(`<video data-hy-video>`)があれば:音なしで自動再生、画面外・タブ非表示・省データで止める、一時停止のボタン。この見本の版は映像が未生成で、静止画(`data-hy-video-missing`)だけ。
- PC は Lenis(lerp 0.1)。↓ のボタンは `initScrollLinks` でヘッダーの下へ移る(このデモには行き先の `#hy-about` がないので何もしない)。
## ファイル
| ファイル | 中身 |
|---|---|
| `src/markup.html` | サーバーが返した節の HTML(JS が書き換える前)。写真は `{{asset:名前}}` |
| `src/style.css` | 節と祖先に当たる規則を、吸収元の CSS の原文のまま(`hiyori.css`・`hiyori-home.css`・`_base.css`。JS が動く前の `hy-failsafe` を含む) |
| `src/js/hero.ts` `reveal.ts` `motion.ts` | 吸収元のモジュールを書き換えずに写したもの(レジストリが blob で照合) |
| `src/index.ts` | 入口。字体と CSS を読み、吸収元の index.ts と同じ順で `initScroll()`・`initHero()`・`initScrollLinks()` を呼ぶ |
| `assets/` | 見本の写真 1 枚(架空の介護グループのために生成した人物写真。案件には書き出さない) |
| `extract.json` | 写した範囲・規則の数・html と body の属性・吸収元の版 |
## 変えたところ
なし(写したモジュールは吸収元と同じ中身)。入口 `index.ts` だけはこの LAB で書いた:
- 吸収元の入口は、検索のカプセルの送信を `initForms`(forms.ts)で受け取って施設の一覧のページへ移し、「ブランドムービーを見る」を `initFilm`(film.ts)でモーダルにする。どちらも別の部品なので写していない。デモでは検索のカプセルの送信だけを止める(どこへも送らない)。「ブランドムービーを見る」は押しても何も起きない。
- 吸収元はページの読み込み直しで片付ける作りで後片付けの関数がないので、`mount()` の戻り値で ScrollTrigger・GSAP の動き・Lenis をまとめて止める。弧の `gsap.ticker` の関数と IntersectionObserver、`initScrollLinks` の document の click は外せない(吸収元のモジュールが外す手段を返さない)。
- 吸収元の入口は load の前に動くが、デモは load の後に読み込まれることがあるので、そのときは `ScrollTrigger.refresh()` をすぐ呼ぶ。
## 使い方
```ts
import { mount } from './src/index';
const unmount = mount(); // .hy-hero がページの最初の節にあること。html に class="js"、body に class="hy hy--home"
```
`html.reduced` を付けると「動き:オフ」(入場・広がり・視差・弧なし)。
## 案件に使うとき(権利)
コードは自社制作。写真・文・検索の項目は架空の見本のものなので差し替える(写真は生成した人物写真なので書き出さない)。参考サイト((参考サイト))の録画から寸法を起こした指示書で作った版なので、色・字体・割り付けは案件のアートディレクションで決め直し、動きの仕組みだけを使う(`technique.json` の `export`)。
## 比較の結果
`node tools/compare.mjs hy-hero-unveil --widths 1440,390` の結果は `reports/compare/hy-hero-unveil.json` と一覧の画像 `reports/compare/hy-hero-unveil/sheet.jpg`。下の「確かめたこと」に書く。
{
"site": "hiyori",
"commit": "1d0bdd63c5909b277c34b2f1e67ea5a5d029a36e",
"route": "/shindan/mihon/hiyori",
"selector": ".hy-hero",
"width": 1440,
"extractedAt": "2026-12-04T21:46:32.334Z",
"htmlAttrs": [
[
"lang",
"ja"
],
[
"data-mihon",
"hiyori"
],
[
"data-taste",
"friendly"
],
[
"data-scale",
"pre"
]
],
"bodyAttrs": [
[
"class",
"hy hy--home"
]
],
"liveHtmlAttrs": [
[
"lang",
"ja"
],
[
"data-mihon",
"hiyori"
],
[
"data-taste",
"friendly"
],
[
"data-scale",
"pre"
],
[
"class",
"js hy-lenis lenis"
]
],
"liveBodyAttrs": [
[
"class",
"hy hy--home"
]
],
"cssLines": 153,
"fonts": [
"var(--sans)",
"inherit"
],
"fontImports": [
"@fontsource-variable/geist/wght.css",
"@fontsource-variable/noto-sans-jp/wght.css"
],
"assets": [
{
"name": "v01-1440.webp",
"from": "/media/shindan/hiyori/v01-1440.webp",
"bytes": 121466,
"sha1": "2deabc542e8473e4c78a2cd3c0b86b35316a874d"
}
],
"js": [
{
"from": "src/scripts/shindan/mihon/hiyori/hero.ts",
"to": "src/js/hero.ts",
"own": true
},
{
"from": "src/scripts/shindan/mihon/hiyori/reveal.ts",
"to": "src/js/reveal.ts",
"own": true
},
{
"from": "src/scripts/shindan/mihon/hiyori/motion.ts",
"to": "src/js/motion.ts",
"own": true
}
],
"warnings": []
}{
"id": "hy-hero-unveil",
"version": "1.0.0",
"title": "下から開く写真の窓が、スクロールで外側の幅まで広がる冒頭",
"category": "heroes",
"level": "section",
"summary": "開いたとき:0.1 秒後から、見出しが下 40%・上から閉じた切り抜き(inset(0 0 100% 0))から 0.95 秒 hy.soft(cubic-bezier(.22,1,.36,1))で立ち上がり、導入文(0.22 秒・y 18)とボタン(0.3 秒・y 14)が続く。写真の窓は 0.28 秒から、上 16% の切り抜きから 1.2 秒 hy.out(cubic-bezier(.19,1,.22,1))で開き、中の写真は 1.08 → 1(1.4 秒)。検索のカプセルは 0.65 秒から y 18 → 0。スクロール:ページの頭から 60vh(最低 200px)までの間に、窓の左右の切り抜き(--hx)が『大きな写真の幅(--media)』から『外側の幅(--shell)』まで縮んで 0 になり、角丸(--hr)は 1.14 倍に(scrub 0.55)。写真は窓を通り過ぎる間に yPercent 0 → 6。窓の上では 3 本の色の弧が 24 秒の周期の 3 つの区間(0.5〜4.3・7.9〜11.6・15.5〜19.2 秒)で 1.3 秒かけて引かれ(3 乗の減速)、区間の最後の 0.7 秒で消える(映像があれば映像の時刻に合わせる)。",
"tags": ["冒頭", "ヒーロー", "clip-path", "窓が開く", "スクロールで広がる", "視差", "SVG の線", "検索のカプセル", "Lenis", "介護・福祉"],
"provenance": {
"site": "hiyori",
"siteName": "ひよりケアグループ(HIYORI CARE)",
"commit": "1d0bdd63c5909b277c34b2f1e67ea5a5d029a36e",
"status": "APPROVED",
"route": "/shindan/mihon/hiyori",
"selector": ".hy-hero",
"files": [
"src/scripts/shindan/mihon/hiyori/hero.ts",
"src/scripts/shindan/mihon/hiyori/reveal.ts(initScrollLinks だけを呼ぶ)",
"src/scripts/shindan/mihon/hiyori/motion.ts",
"src/styles/mihon/hiyori.css",
"src/styles/mihon/hiyori-home.css",
"src/styles/mihon/_base.css",
"src/pages/shindan/mihon/hiyori/index.astro・src/components/hiyori/FindBar.astro・Mark.astro(節のマークアップはサーバーの HTML から)"
],
"spec": "prompts/hiyori.md",
"basis": "provenance/decisions.json の hiyori(APPROVED の根拠と事業者の指示の日時)",
"motionSpec": "吸収元の docs/mihon-hiyori/MOTION_SPEC.md の 2-5 と M08〜M13"
},
"dependencies": {
"gsap": "3.15.1",
"gsap/ScrollTrigger": "3.15.1",
"gsap/CustomEase": "3.15.1(hy.out = 0.19,1,0.22,1 / hy.soft = 0.22,1,0.36,1)",
"gsap/Flip": "3.15.1(motion.ts が登録だけする。この節では使わない)",
"lenis": "1.3.27(PC だけ。lerp 0.1)",
"@fontsource-variable/geist": "5.3.0",
"@fontsource-variable/noto-sans-jp": "5.3.1"
},
"license": {
"code": "便利DEネットの自社制作(見本サイトのために書いたコード)",
"fonts": "OFL(fontsource のパッケージから読む。字体ファイルは持ち込まない)",
"assets": "架空の介護グループの見本のために GPT で生成した写真 1 枚(高齢の女性と職員。人物の生成は事業者の指示書で hiyori だけに認められたもの)。実在の施設・人物・実績ではない",
"reference": "参考サイト (参考サイト)((参考サイト))の録画から起こした指示書の寸法で作った版(事業者が 2026-12-04 06:06 に『全く一緒』と述べた、独自性の作り替え 0249975 の前の版 1d0bdd6)。参考の写真・文章・字体・コードは持ち込んでいない"
},
"export": {
"policy": "code-restyle",
"code": true,
"assets": false,
"copy": false,
"requires": [
"写真・見出し・導入文・検索の項目は案件のものに差し替える。見本の写真は架空の介護グループのために生成した人物写真なので、書き出さない",
"参考サイトの完全再現として作った版なので、色・字体・割り付け(外側 / 大きな写真 / 本文の 3 つの幅、検索のカプセルの形、弧の色と形)は案件のアートディレクションで決め直し、動きの仕組み(下から開く窓・スクロールで外側の幅まで広がる切り抜き・時刻で引かれる線)だけを使う",
"ブランドムービー(<video data-hy-video>)を置けば、映像の自動再生・画面外と省データで止める・一時停止のボタン・映像の時刻に合わせた弧が hero.ts でそのまま動く。この見本の版は映像が未生成で、静止画(data-hy-video-missing)だけで確かめた"
]
},
"customizable": [
{ "name": "写真・映像", "how": "markup の [data-hy-hero=media] の中。<img data-hy-video-missing> か <video data-hy-video>(ポスターと source)" },
{ "name": "文", "how": "[data-hy-hero=title] の見出し・[data-hy-hero=lead] の導入文・[data-hy-hero=btn] のボタン" },
{ "name": "3 つの幅", "how": ".hy の --shell(外側=広がりきった幅)・--media(開いたときの写真の幅)・--content(本文)。1440・1179・767px で替わる" },
{ "name": "広がる距離", "how": "js/hero.ts の end: max(200, innerHeight × 0.6) と scrub 0.55(書き換えるときは technique の changes に理由を書く)" },
{ "name": "角丸", "how": "js/hero.ts の r0 = min(56, max(20, 画面の幅 × 0.022)) px と広がったときの 1.14 倍" },
{ "name": "弧の色と形", "how": "svg[data-hy-arcs] の path(stroke の色、d)。区間は js/hero.ts の win(24 秒の周期)" },
{ "name": "色・字体", "how": ".hy の --surface・--bg・--ink・--line と --sans(Geist+Noto Sans JP)。窓の地 .hy-hero__clip の #C9D3CA" }
],
"invariants": [
"窓は clip-path の inset(左右 --hx・角丸 --hr)で切り抜く。拡大縮小やフェードに置き換えない",
"入場の順と時刻:見出し 0.1 秒 → 窓 0.28 秒 → 導入文 0.22 秒 → ボタン 0.3 秒 → 検索 0.65 秒。窓は 1.2 秒 hy.out、写真は 1.08 → 1 を 1.4 秒",
"広がりはページの頭から 60vh(最低 200px)の scrub 0.55。戻すと元の幅へ戻る",
"写真の視差は yPercent 0 → 6(枠が画面の頭から抜けるまで)",
"弧は 3 本が別々の区間で引かれて消える(同時に全部を出さない)。画面外・タブが隠れている間は計算しない",
"検索のカプセルは窓の下端に重ね(1023px 以下は窓のすぐ下)、窓と一緒に開かない(遅れて上がる)"
],
"industries": ["care", "medical", "corporate", "hospitality", "all"],
"artDirections": ["ad-hiyori"],
"combine": {
"goodWith": ["浮くカプセルのヘッダー(冒頭の上の余白はその分を空けてある)", "冒頭の直後に、文と写真の節(私たちについてなど)"],
"avoid": ["同じページの冒頭にもう 1 つ全幅の映像・スライドを置く", "冒頭の上に別の固定の幕を重ねる(入場の時刻が見えなくなる)"],
"note": "広がりの ScrollTrigger は start: 0(ページの頭)から測るので、ページの最初の節として置く。html・body・* に効く初期化の規則(_base.css)と、body の class=\"hy hy--home\" に置いた変数を含む。Lenis はページ全体のスクロールを替える"
},
"performance": {
"images": "写真 1 枚(v01-1440.webp・fetchpriority=high)。映像を置くときは PC 用とスマホ用(767px 以下)の source を分ける",
"animation": "clip-path(窓の入場 1 回)と CSS 変数 --hx・--hr(スクロール)、transform(scale・yPercent)。弧は gsap.ticker で stroke-dashoffset と opacity を毎コマ書く(画面外では止める)",
"notes": "冒頭の入場は読み込みの直後に 1 回だけ"
},
"responsive": {
"breakpoints": ["1440px(幅の変数)", "1179px(見出しとボタンを縦に)", "1023px(検索のカプセルを窓の下へ・2 列)", "767px(窓を 4:5 に、上の余白をヘッダーに合わせる、検索は 1 列)"],
"verified": ["1440×900", "390×844"]
},
"accessibility": {
"roles": "section に見出しの aria-labelledby。弧の svg と大きな印は aria-hidden。検索は form role=search と aria-label",
"controls": "↓ はページ内リンク(ヘッダーの下に止まり、0.7 秒後に行き先へフォーカス)。映像があるときは一時停止のボタン(aria-pressed と aria-label が替わる)",
"focus": ".hy :focus-visible に 2px の線。検索の欄はフォーカスで地が替わる(:focus-within)",
"touch": "検索の欄の select は見た目の行の高さのまま押せる高さ 44px"
},
"reducedMotion": {
"rule": "見本の決まり:サイトの「動き:オフ」(html.reduced)のときだけ止める(motion.ts の reduced() は html.reduced だけを見る)。OS の「動きを減らす」では止めない(事業者の決まり 2026-11-30。吸収元の指示書 32-8 は OS に従うことを求めており、事業者の確認待ち)",
"whenOff": "入場・広がり・視差・弧はすべて動かさず、最初から開いた窓(左右は大きな写真の幅)と文を見せる。映像は自動で再生しない(ボタンで再生)。Lenis は作らない"
},
"verify": {
"frames": [0, 250, 500, 900, 1300, 1700, 2300, 2700, 3200],
"actions": [
{ "at": 100, "scrollBy": 160, "note": "窓が外側の幅へ広がり始める(scrub 0.55 で追いつく)" },
{ "at": 1100, "scrollBy": 260, "note": "60vh を越えて広がりきる" },
{ "at": 2400, "scrollBy": -420, "note": "戻すと元の幅へ戻る" }
],
"recordMs": 4000
}
}