SVG <polyline>


SVG Polyline - <polyline>

Contoh 1

Elemen <polyline> digunakan untuk membuat bentuk apa pun yang hanya terdiri dari garis lurus (yang terhubung di beberapa titik):

Sorry, your browser does not support inline SVG.

Berikut adalah kode SVG:

Contoh

<svg height="200" width="500">
  <polyline points="20,20 40,25 60,40 80,120 120,140 200,180"
  style="fill:none;stroke:black;stroke-width:3" />
</svg>

Penjelasan kode:

  • Atribut poin mendefinisikan daftar titik (pasangan koordinat x dan y) yang diperlukan untuk menggambar polyline

Contoh 2

Contoh lain dengan hanya garis lurus:

Sorry, your browser does not support inline SVG.

Berikut adalah kode SVG:

Contoh

<svg height="180" width="500">
  <polyline points="0,40 40,40 40,80 80,80 80,120 120,120 120,160"
  style="fill:white;stroke:red;stroke-width:4" />
</svg>