動きの質感を選ぶ(Easing)
このページでは、Framer Motion(useAnimate の ease)・GSAP(ease の文字列)・CSS Transition(cubic-bezier と linear())を使ったイージング(Easing)の実装パターンを、インタラクティブなデモとコードで確認できます。
イージング(Easing)とはアニメーションの「加速・減速の曲線」のこと。同じ距離・同じ時間でも、イージングによって動きの印象は大きく変わる。
「再生」ボタンを押すと全ての要素が同時にスタート。到着タイミングと動きの質感の違いを一目で比較できる。
Framer Motion
useAnimate の animate() に ease を渡す。名前(easeOut・circOut・backOut・anticipate など)か、cubic-bezier の4つの数の配列で指定する。bounce・elastic の名前は無く、式を関数で渡すか、type: "spring" で弾ませる。
読み込み中...
'use client';
import { useRef, useState } from 'react';
import { useAnimate, type Easing } from 'motion/react';
// ease は、名前(文字列)か cubic-bezier の4つの数の配列で指定する
const EASINGS: Easing[] = ['easeOut', 'circOut', 'backOut', 'anticipate'];
const BALL = 36;
export default function EasingCompare() {
// scope の中の要素を、animate() にセレクタで渡せる
const [scope, animate] = useAnimate();
const trackRef = useRef<HTMLDivElement>(null);
const [playing, setPlaying] = useState(false);
const play = async () => {
if (playing) return;
setPlaying(true);
// 移動距離はトラックの幅から計算する(ボールの幅ぶん引く)
const x = (trackRef.current?.clientWidth ?? 256) - BALL;
// 4つを同時に始め、すべて終わるまで待つ
await Promise.all(
EASINGS.map((ease, i) => animate(`.ball-${i}`, { x: [0, x] }, { duration: 1.2, ease })),
);
setPlaying(false);
};
const reset = () => {
// 同じ値の新しいアニメーションを始めると、動いている途中のものは止まる
animate('.ball', { x: 0 }, { duration: 0 });
setPlaying(false);
};
return (
<div ref={scope}>
<div style={{ display: 'flex', gap: 12, marginBottom: 16 }}>
<button onClick={play} disabled={playing}>再生</button>
<button onClick={reset}>リセット</button>
</div>
{EASINGS.map((ease, i) => (
<div key={String(ease)} style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 12 }}>
<code style={{ width: 80 }}>{String(ease)}</code>
<div ref={i === 0 ? trackRef : undefined} style={{ flex: 1, height: BALL, position: 'relative', overflow: 'hidden' }}>
<div
className={`ball ball-${i}`}
style={{ width: BALL, height: BALL, borderRadius: '50%', background: '#c084fc', position: 'absolute' }}
/>
</div>
</div>
))}
</div>
);
}AIプロンプトテンプレート
Next.js + Motion(motion/react)でイージングの比較デモを実装してください。 - 4つのボールを同時にスタートさせ、同じ距離・同じ時間で動きの違いを比べる - useAnimate の animate() で x を動かし、ease に 'easeOut'・'circOut'・'backOut'・'anticipate' を指定する - 移動距離はトラックの幅からボールの幅を引いて計算する - 再生ボタン(再生中は押せない)とリセットボタンを付ける - TypeScript / Tailwind CSS v4 を使用
このプロンプトはあくまでたたき台です。AIの回答はモデルやバージョン、会話の文脈によって毎回異なります。意図通りに動かない場合は、条件を追記・修正してお使いください。
実装方法の比較
| 項目 | Framer Motion | GSAP | CSS Transition |
|---|---|---|---|
| ease指定方法 | 名前(文字列)・cubic-bezier の配列・関数 | 文字列(power・back・bounce等) | キーワード・cubic-bezier()・linear() |
| bounce・elastic | 名前は無い。式を関数で渡すか、spring で弾ませる | bounce.out / elastic.out を標準で持つ | linear() の折れ線で再現できる(点は自分で作る) |
| カスタムeasing | cubicBezier()・関数を渡す | CustomEaseプラグイン | cubic-bezier()・linear() |
| ease種類の豊富さ | 中(CSS準拠+spring) | 高(最多・bounce/elasticも自在) | 標準のキーワードは少ない。linear() でどんな曲線も折れ線で表せる |
同じカテゴリの他のページ
文字を演出する(Text Animation)の実装比較
Framer Motion・GSAPの文字アニメーション(Text Animation)実装を比較。SplitText・ScrambleTextと自前の分割で、1文字ずつのフェード・スライド・波・スクランブル・再集合のデモ・コード付き。
スクロールで物語る(Scroll Storytelling)の実装比較
GSAPのScrollTriggerで実装するスクロール演出のサンプル。scrub・pin・横スクロール・パララックスなど、スクロールに連動した高度なアニメーションのUIパターン実例集。デモ・コード付き。
スクロールで見せる(Scroll Reveal)の実装比較
Framer Motion・React Spring・GSAP・Intersection Observerのスクロールで見せるアニメーション実装を比較。whileInView・ScrollTriggerのデモ・コード付き。