12 の原則
Section titled “12 の原則”personality
- 01Squash & Stretch潰しと伸ばしstraightAhead · deform
- 02Anticipation予備動作anticipate · poseToPose
- 03Staging演出・見せ方stagingPoses
- 04Straight Ahead & Pose to Pose逐次描画とポーズ間補間poseToPose · straightAhead
- 05Follow Through & Overlappingフォロースルーと重なりoverlap · followThrough
- 06Slow In & Slow Out加速と減速easings
- 07Arcs弧を描く動きarc · arcPoint
- 08Secondary Action副次的な動きaccompany · jump
- 09Timingタイミングdurations
- 10Exaggeration誇張exaggerate · jump
- 11Solid Drawing立体感と重さtiltToward · lift · solid
- 12Appeal魅力・個性enter · exit · personalities
3 行で分かる使い方
Section titled “3 行で分かる使い方”import { anticipate, followThrough, play, enter } from "twelve-principles";import { Motion } from "twelve-principles/react";
play(card, followThrough(anticipate(enter("rise")))); // 原則は関数なので合成できる
<Motion as="button" press hover enter="pop">保存</Motion>; // React ならプロップで宣言原則 = 関数
anticipate(spec)やexaggerate(spec, 1.5)は MotionSpec を受け取って MotionSpec を返す純粋関数。好きな順に重ねられ、テストもできます。UI 向けの既定値
ユーザー操作は 300ms 以内、スタッガーは 1 項目 50ms 以内、入場は ease-out・退場は ease-in。押下の縮みは既定のガードレールで 2〜5% に収まり、bouncy と cartoon はその上限を外します。何も考えずに使うと良い動きになるように。
割り込みに強い
再生中の姿勢を JS で正確にサンプリングできるので、ホバー中に押す・閉じかけを開き直すといった割り込みでも飛びません。
アクセシブル
prefers-reduced-motionを既定で尊重し、空間移動を短いフェードに置き換えます。キーボード押下にも反応します。