Skip to Content
SVGエッセンシャルズ 第2版
book

SVGエッセンシャルズ 第2版

by J. David Eisenberg, Amelia Bellamy-Royds, 原 隆文
May 2017
Intermediate to advanced
432 pages
5h 26m
Japanese
O'Reilly Japan, Inc.
Content preview from SVGエッセンシャルズ 第2版

4章基本図形

<svg>タグで座標系が確立されたら、描画を始める準備が整ったことになります。この章では基本的な図形、すなわち直線、矩形、多角形、円、楕円について説明します。これらを使うと、ほとんどの図形の主要な要素を作成できます。

4.1 直線

SVGの<line>要素を使うと、直線を描画できます。直線を定義するには、端点のx座標とy座標を指定します。座標は単位を付けずに指定することができ、その場合はユーザー座標と見なされます。あるいは、em、inなどの単位を付けて指定することもできます(「3.1 ビューポート」を参照)。

<line x1="start-x" y1="start-y"
  x2="end-x" y2="end-y" />

ここでx1とy1は始点の座標を、x2とy2は終点の座標を表します。例4-1のSVGは、いくつかの直線を描画します。図4-1に示されているグリッドは参考のためのもので、このSVGの一部ではありません。

例4-1 基本的な直線(http://oreillymedia.github.io/svg-essentials-examples/ch04/basic-lines.html)

<svg width="200px" height="200px" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"> <!-- 横線 --> <line x1="40" y1="20" x2="80" y2="20" style="stroke: black;"/> <!-- 縦線 --> <line x1="0.7cm" y1="1cm" x2="0.7cm" y2="2.0cm" style="stroke: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

詳解 システム・パフォーマンス 第2版

詳解 システム・パフォーマンス 第2版

Brendan Gregg, 西脇 靖紘, 長尾 高弘
仕事ではじめる機械学習 第2版

仕事ではじめる機械学習 第2版

有賀 康顕, 中山 心太, 西林 孝

Publisher Resources

ISBN: 9784873117973Other