forked from oreillymedia/svg-essentials-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
198 lines (184 loc) · 16 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!DOCTYPE html>
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SVG Essentials Examples</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>SVG Essentials Examples</h1>
<p>
This repository contains interactive examples and other files created for <a href="http://shop.oreilly.com/product/0636920032335.do"><cite>SVG Essentials, 2nd Edition</cite></a> by J. David Eisenberg and Amelia Bellamy-Royds (O'Reilly, 2014). The repository also includes the examples used in <a href="http://radar.oreilly.com/2014/11/the-once-and-future-svg.html">a related post on the O'Reilly Radar blog</a>.
</p>
<!--
<img alt="Cover image of SVG Essentials" src="http://akamaicovers.oreilly.com/images/0636920032335/lrg.jpg"/>
-->
<p>
If you're reading the online version of the book, you'll see these examples embedded in your browser (they are hosted as Github pages). If you're reading the print book or PDF/ePUB/Kindle formats, these are the examples given as links.
</p>
<p>
Many examples display the code as well as the final SVG, and the code can usually be live edited; type within the code blocks that have a green border, or use the drop-down lists to switch between options, then select “Refresh” to see the results, or “Reset” to undo.
</p>
<p>
To save on typing long URLs, here's an index of all the interactive examples:
</p>
<ul>
<li>Chapter 1. Getting Started
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch01/ex01-02.html">Basic shapes–circle</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch01/ex01-03.html">Basic shapes–filled circles</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch01/ex01-04.html">Basic shapes–lines</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch01/ex01-05.html">Transforming the coordinate system</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch01/ex01-06.html">Basic shapes–polylines</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch01/ex01-07.html">Using the <path> element</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch01/ex01-08.html">Adding a label</a></li>
</ul>
</li>
<li>Chapter 2. Using SVG in Web Pages
<ul>
<li>(No live examples—although, really, <em>all</em> the live examples are examples of using SVG in web pages!)</li>
</ul>
</li>
<li>Chapter 3. Coordinates
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch03/default_coordinates.html">Using default coordinates</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch03/explicit_units.html">Explicit use of units</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch03/units_on_svg.html">Units on the svg element</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch03/using_viewbox.html">Using a viewBox</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch03/meet_slice_specifier.html">Using preserveAspectRatio</a></li>
</ul></li>
<li>Chapter 4. Basic Shapes
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/basic-lines.html">Basic lines</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/stroke-width.html">Demonstration of stroke-width</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/stroke-color.html">Demonstration of stroke color</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/stroke-opacity.html">Demonstration of stroke-opacity</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/stroke-dasharray.html">Demonstration of stroke-dasharray</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/rectangle.html">Demonstration of the rectangle element</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/rounded-rectangles.html">Demonstration of rounded rectangles</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/circles-ellipses.html">Demonstration of circles and ellipses</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/polygon.html">Demonstration of the polygon element</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/polygon-fill.html">Effect of different fill-rules</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/polyline.html">The polyline element</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/linecap.html">Values of the stroke-linecap property</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch04/linejoin.html">Values of the stroke-linejoin attribute</a></li>
</ul></li>
<li>Chapter 5. Document Structure
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch05/internal-stylesheets.html">Use of internal stylesheet</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch05/defs-example.html">The defs element</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch05/symbol.html">Symbols versus groups</a></li>
</ul></li>
<li>Chapter 6. Transforming the Coordinate System
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch06/translate.html">Moving the coordinate system with translation</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch06/scale.html">Uniformly scaling a graphic</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch06/sequence.html">Sequence of transformations</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch06/rotate.html">Rotation around the origin</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch06/rotate-center.html">Rotation around a center point</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch06/skew.html">skewX and skewY</a></li>
</ul></li>
<li>Chapter 7. Paths
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch07/moveto-lineto.html">Using moveto and lineto</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch07/arc.html">Elliptical arcs</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch07/quadratic-bezier.html">Quadratic Bézier curves</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch07/smooth-quadratic-bezier.html">Smooth quadratic Bézier curves</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch07/cubic-bezier.html">Cubic Bézier curves</a></li>
</ul></li>
<li>Chapter 8. Patterns and Gradients
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/linear_gradient.html">Simple two-color gradient</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/three_stop_gradient.html">Three-color gradient</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/stop_opacity.html">Three-opacity gradient</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/transition_line.html">Defining vectors for a linear gradient</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/spread_method.html">Effects of spreadMethod values on a linear gradient</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/three_stop_radial.html">Radial gradient with three stops</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/radial_limits.html">Setting limits for a radial gradient</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/radial_focus.html">Setting focal point for a radial gradient</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/radial_spread_method.html">Effects of spreadMethod values on a radial gradient</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch08/pattern_gradient_transform.html">Transforming patterns and gradients</a></li>
</ul></li>
<li>Chapter 9. Text
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch09/text_alignment.html">Use of text-anchor</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch09/text_length.html">Use of textLength and lengthAdjust</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch09/text_path.html">Examples of textPath</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch09/start_offset.html">Text length and startOffset</a></li>
</ul></li>
<li>Chapter 10. Clipping and Masking
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch10/clip_path.html">Clipping to a rectangular path</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch10/complex_clip_path.html">Complex clip paths</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch10/alpha_opacity_mask.html">Mask alpha using opacity only</a></li>
</ul></li>
<li>Chapter 11. Filters
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch11/hue_rotate.html">feColorMatrix hueRotate</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch11/saturate.html">feColorMatrix saturate</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch11/linear_transfer.html">Changing brightness with feComponentTransfer</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch11/gamma_transfer.html">Gamma adjustment with feComponentTransfer</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch11/fe_morphology.html">Thickening and thinning with feMorphology</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch11/convolve.html">feConvolveMatrix playground</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch11/turbulence.html">feTurbulence playground</a></li>
</ul></li>
<li>Chapter 12. Animating SVG
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/simple_animation.html">The incredible shrinking rectangle</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/multiple_animation.html">Multiple animations on a single object</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/multiple_animation2.html">Simple animation of multiple objects</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/sync_with_offset.html">Synchronization of animations with offsets</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/repeated_action.html">Example of repeated animation</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/sync_repetition.html">Synchronizing an animation with a repetition</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/animate_color.html">Example of animating color</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/animate_path_poly.html">Example of animating path and polygon</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/animating_values.html">Animating color by specific values</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/animation_set.html">Example of set element</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/animate_transform.html">Example of animateTransform</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/linear_animateMotion.html">Animation along a linear path</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/complex_animate_motion.html">Animation along a complex path</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/animate_motion_rotate.html"> Animation along a complex path with auto-rotation</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/key_points.html">Variable speed motion along a path using keyPoints and keyTimes</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/svg_css_anim1.html">Key frame specification in CSS</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch12/svg_css_anim2.html">CSS animation playground</a></li>
</ul></li>
<li>Chapter 13. Adding Interactivity
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/svg_link.svg">Links in SVG</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/svg_css_link.svg">Links in SVG highlighted with CSS</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/anim_css_link.svg">Animating a link with :hover</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/smil_event_animation.svg">Interactive Animation</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/basic_dom_example.svg">Accessing SVG with the DOM</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/simple_event.svg">Adding mouse movement listeners</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/shirt1.svg">Changing multiple objects in a script</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/drag_objects.svg">Dragging objects</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/shirt_interact.html">Interacting with HTML</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch13/shirt_create.html">Creating new elements</a></li>
</ul></li>
<li>Chapter 14. Using the SVG DOM
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch14/baseval_animval.svg">Using the baseVal and animVal properties</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch14/animated_clock_js.svg">Animating a clock with JavaScript</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch14/snap_animated_clock.svg">Drawing and animating a clock with Snap.svg</a></li>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch14/snap_events.html">Click and drag events in Snap</a></li>
</ul></li>
<li>Chapter 15. Generating SVG
<ul>
<li><a href="https://s-ekin.github.io/svg-essentials-examples/ch15/KSJC.xml">XSLT-generated SVG weather forecast</a>
(Uses the XSLT 1.0 processor in your browser; may not be supported in all mobile browsers.)</li>
</ul>
</li>
</ul>
<p>
If you've stumbled upon this page and don't yet have your copy of <cite>SVG Essentials</cite>, be aware that the above outline <em>only</em> includes the interactive examples; there are some topics which were easier to describe with good old-fashioned code snippets and figures.
</p>
<hr style="width:25%"/>
<p>
The examples are covered by the standard <a href="http://shop.oreilly.com/category/customer-service/faq-examples.do">example permissions policy for O'Reilly books</a>, reproduced below for your convenience:
</p>
<blockquote>
<p><strong>Using Code Examples</strong></p>
<p>Our books are here to help you get your job done. In general, you may use the code in our books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.</p>
<p>We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.</p>
<p>If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <a href="mailto:[email protected]">[email protected]</a>.</p>
</blockquote>