SVG / 087

Bézier curve

ベジェ曲線
始点・終点と制御点で、滑らかな曲線を描きます。

実際のHTML・CSSで描かれた見本です。

ラボで詳しく試す ↗

ひとつ試すなら

どこが変わるかを観察して、似た表現と見比べてみよう。

こんなときに

アイコン、経路、図形の輪郭。

仕組みと使い方

制御点は曲線が必ず通る点ではなく、曲がり方を決める点です。

曲線ベジェbezierパス
実装コードを見る
<style>
.sample{width:100%;height:100%;min-height:190px;display:grid;place-items:center;position:relative;overflow:hidden;box-sizing:border-box;font-family:Arial,'Hiragino Kaku Gothic ProN',Meiryo,sans-serif;color:#20211d;background:#f1f0e9;padding:22px}.sample *{box-sizing:border-box}.sample button,.sample input,.sample summary{font:inherit}.sample button,.sample summary,.sample label{touch-action:manipulation}.sample :focus-visible{outline:3px solid #6050bf;outline-offset:5px}.sample small{font-size:10px;line-height:1.5}.sample .editable{margin:0}.sample svg{max-width:100%;height:auto}
.sample svg{width:230px;overflow:visible}
</style>
<div class="sample">
<svg viewBox="0 0 240 140" role="img" aria-label="制御点とベジェ曲線"><path d="M25 110 65 0M215 30 165 140" stroke="#aaa" stroke-dasharray="3 4" fill="none"/><path d="M25 110C65 0 165 140 215 30" stroke="#242521" stroke-width="5" fill="none"/><g fill="#a78ad9"><circle cx="25" cy="110" r="7"/><circle cx="215" cy="30" r="7"/></g><g fill="#ff865d"><circle cx="65" cy="0" r="6"/><circle cx="165" cy="140" r="6"/></g></svg>
</div>