|
525
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8"> |
|
|
5 |
<title>Example: Complex Drawing: Violin</title> |
|
|
6 |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic"> |
|
|
7 |
<link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css"> |
|
|
8 |
<link rel="stylesheet" href="../assets/css/main.css"> |
|
|
9 |
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> |
|
|
10 |
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png"> |
|
|
11 |
<script src="../../build/yui/yui-min.js"></script> |
|
|
12 |
|
|
|
13 |
</head> |
|
|
14 |
<body> |
|
|
15 |
<!-- |
|
|
16 |
<a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a> |
|
|
17 |
--> |
|
|
18 |
<div id="doc"> |
|
|
19 |
<div id="hd"> |
|
|
20 |
<h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1> |
|
|
21 |
</div> |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
<h1>Example: Complex Drawing: Violin</h1> |
|
|
25 |
<div class="yui3-g"> |
|
|
26 |
<div class="yui3-u-3-4"> |
|
|
27 |
<div id="main"> |
|
|
28 |
<div class="content"><style scoped> |
|
|
29 |
#custom-doc { width: 95%; min-width: 950px; } |
|
|
30 |
#pagetitle {background-image: url(../../assets/bg_hd.gif);} |
|
|
31 |
#outerframe { |
|
|
32 |
display: inline-block; |
|
|
33 |
height: 446px; |
|
|
34 |
width: 714px; |
|
|
35 |
} |
|
|
36 |
|
|
|
37 |
#mygraphiccontainer { |
|
|
38 |
display: inline-block; |
|
|
39 |
top: 100px; |
|
|
40 |
width: 614px; |
|
|
41 |
top: 15px; |
|
|
42 |
left: 34px; |
|
|
43 |
position: relative; |
|
|
44 |
} |
|
|
45 |
.woodgrain{ |
|
|
46 |
opacity:0.2; |
|
|
47 |
filter:alpha(opacity=20); |
|
|
48 |
} |
|
|
49 |
</style> |
|
|
50 |
<div class="intro"> |
|
|
51 |
<p> |
|
|
52 |
This example shows how to use the <code>Graphics</code> to draw the head of a violin. |
|
|
53 |
</p> |
|
|
54 |
<p> |
|
|
55 |
The comparable uncompressed .jpg photo image of the violin head was 161KB, .png(24-bit) was 359KB. |
|
|
56 |
The Graphics code to render this example is 18KB. |
|
|
57 |
</p> |
|
|
58 |
</div> |
|
|
59 |
<div class="example"> |
|
|
60 |
<div id="outerframe"> |
|
|
61 |
<div id="mygraphiccontainer"></div> |
|
|
62 |
</div> |
|
|
63 |
<script> |
|
|
64 |
YUI().use('graphics', function (Y) |
|
|
65 |
{ |
|
|
66 |
//create a graphic instance |
|
|
67 |
var mygraphic = new Y.Graphic(); |
|
|
68 |
mygraphic.render("#mygraphiccontainer"); |
|
|
69 |
|
|
|
70 |
//draw a background |
|
|
71 |
var background = mygraphic.addShape({ |
|
|
72 |
type: "rect", |
|
|
73 |
stroke: { |
|
|
74 |
weight: 0, |
|
|
75 |
color: "#f00", |
|
|
76 |
opacity: 0 |
|
|
77 |
}, |
|
|
78 |
fill: { |
|
|
79 |
type: "radial", |
|
|
80 |
stops: [ |
|
|
81 |
{color: "#001000", opacity: 1, offset: 0}, |
|
|
82 |
{color: "#000", opacity: 1, offset: 1} |
|
|
83 |
] |
|
|
84 |
}, |
|
|
85 |
width: 614, |
|
|
86 |
height: 397, |
|
|
87 |
x: 0, |
|
|
88 |
y: 0 |
|
|
89 |
}); |
|
|
90 |
|
|
|
91 |
//create a path element to use for the strings |
|
|
92 |
var strings = mygraphic.addShape({ |
|
|
93 |
type: "path", |
|
|
94 |
stroke: { |
|
|
95 |
weight: 2, |
|
|
96 |
color: "#bbb" |
|
|
97 |
} |
|
|
98 |
}); |
|
|
99 |
|
|
|
100 |
//draw strings |
|
|
101 |
strings.moveTo(614,199); |
|
|
102 |
strings.lineTo(536,181); |
|
|
103 |
strings.curveTo(532,178,519,181,515,183); |
|
|
104 |
strings.lineTo(465,197); |
|
|
105 |
strings.lineTo(487,203); |
|
|
106 |
strings.lineTo(515,187); |
|
|
107 |
strings.curveTo(519,184,529,182,536,184); |
|
|
108 |
strings.lineTo(613,202); |
|
|
109 |
strings.end(); |
|
|
110 |
|
|
|
111 |
//create a path element to use for the fingerboard |
|
|
112 |
var finger_board = mygraphic.addShape({ |
|
|
113 |
type: "path", |
|
|
114 |
stroke: { |
|
|
115 |
weight: 1, |
|
|
116 |
color: "#f00", |
|
|
117 |
opacity: 0 |
|
|
118 |
}, |
|
|
119 |
fill: { |
|
|
120 |
type: "linear", |
|
|
121 |
rotation: 140, |
|
|
122 |
stops: [ |
|
|
123 |
{color: "#000", opacity: 1, offset: 0}, |
|
|
124 |
{color: "#000", opacity: 1, offset: 0.2}, |
|
|
125 |
{color: "#302420", opacity: 1, offset: 0.8} |
|
|
126 |
] |
|
|
127 |
} |
|
|
128 |
}); |
|
|
129 |
|
|
|
130 |
//draw the fingerboard |
|
|
131 |
finger_board.moveTo(613,231); |
|
|
132 |
finger_board.lineTo(507,204); |
|
|
133 |
finger_board.curveTo(506,186,527,183,533,186); |
|
|
134 |
finger_board.lineTo(613,205); |
|
|
135 |
finger_board.end(); |
|
|
136 |
|
|
|
137 |
//Highlight for the fingerboard |
|
|
138 |
var fingerboard_high = mygraphic.addShape({ |
|
|
139 |
type: "path", |
|
|
140 |
stroke: { |
|
|
141 |
weight: 1, |
|
|
142 |
color: "#555", //, dashstyle: [3, 4] |
|
|
143 |
opacity: 0.5 |
|
|
144 |
} |
|
|
145 |
}); |
|
|
146 |
|
|
|
147 |
fingerboard_high.moveTo(512,199); |
|
|
148 |
fingerboard_high.curveTo(517,193,527,190,534,191); |
|
|
149 |
fingerboard_high.end(); |
|
|
150 |
|
|
|
151 |
//Create a path to use for the headstock |
|
|
152 |
var head = mygraphic.addShape({ |
|
|
153 |
type: "path", |
|
|
154 |
stroke: { |
|
|
155 |
weight: 0, |
|
|
156 |
color: "#f00", |
|
|
157 |
opacity: 1 //, |
|
|
158 |
//dashstyle: [3, 4] |
|
|
159 |
}, |
|
|
160 |
fill: { |
|
|
161 |
type: "linear", |
|
|
162 |
rotation: 60, |
|
|
163 |
stops: [ |
|
|
164 |
{color: "#9B4D17", opacity: 1, offset: 0}, |
|
|
165 |
{color: "#3B1E09", opacity: 1, offset: 0.8} |
|
|
166 |
] |
|
|
167 |
} |
|
|
168 |
}); |
|
|
169 |
|
|
|
170 |
//Draw the headstock |
|
|
171 |
head.moveTo(614,278); |
|
|
172 |
head.lineTo(553,263); |
|
|
173 |
head.curveTo(516,255,503,283,500,300); |
|
|
174 |
head.lineTo(496,318); |
|
|
175 |
head.curveTo(496,323,488,323,486,318); |
|
|
176 |
head.curveTo(405,233,310,332,218,321); |
|
|
177 |
head.curveTo(149,320,101,270,99,217); |
|
|
178 |
head.curveTo(96,182,120,143,141,132); |
|
|
179 |
head.curveTo(162,116,199,116,223,131); |
|
|
180 |
head.curveTo(242,140,260,170,253,202); |
|
|
181 |
head.curveTo(249,228,230,242,213,246); |
|
|
182 |
head.curveTo(214,249,218,257,235,246); |
|
|
183 |
head.curveTo(254,233,299,209,324,199); |
|
|
184 |
head.curveTo(369,182,428,185,470,195); |
|
|
185 |
head.lineTo(505,204); |
|
|
186 |
head.lineTo(506,203); |
|
|
187 |
head.lineTo(614,231); |
|
|
188 |
head.end(); |
|
|
189 |
|
|
|
190 |
//Outer portion of the spiral on top of the head |
|
|
191 |
var outerTopScroll = mygraphic.addShape({ //outter top scroll |
|
|
192 |
type: "path", |
|
|
193 |
stroke: { |
|
|
194 |
weight: 0, |
|
|
195 |
color: "#00dd00", // , dashstyle: [3, 4] |
|
|
196 |
opacity: 1 |
|
|
197 |
}, |
|
|
198 |
fill: { |
|
|
199 |
type: "linear", // |
|
|
200 |
rotation: 90, |
|
|
201 |
stops: [ |
|
|
202 |
{color: "#562A0D", opacity: 1, offset: 0}, |
|
|
203 |
{color: "#68340F", opacity: 1, offset: 1} |
|
|
204 |
] |
|
|
205 |
} |
|
|
206 |
}); |
|
|
207 |
outerTopScroll.moveTo(106,229); |
|
|
208 |
outerTopScroll.curveTo(104,190,116,154,144,137); |
|
|
209 |
outerTopScroll.curveTo(169,121,214,121,237,150); |
|
|
210 |
outerTopScroll.curveTo(251,173,258,209,229,230); |
|
|
211 |
outerTopScroll.lineTo(219,227); |
|
|
212 |
outerTopScroll.curveTo(219,212,237,170,210,157); |
|
|
213 |
outerTopScroll.curveTo(175,134,132,167,146,216); |
|
|
214 |
outerTopScroll.curveTo(147,220,152,232,156,234); |
|
|
215 |
outerTopScroll.lineTo(105,229); |
|
|
216 |
outerTopScroll.end(); |
|
|
217 |
|
|
|
218 |
//Inner portion of the spiral on top of the head |
|
|
219 |
var innerTopScroll = mygraphic.addShape({ // inner top scroll |
|
|
220 |
type: "path", |
|
|
221 |
stroke: { |
|
|
222 |
weight: 0, |
|
|
223 |
color: "#00dd00", // , dashstyle: [3, 4] |
|
|
224 |
opacity: 1 |
|
|
225 |
}, |
|
|
226 |
fill: { |
|
|
227 |
type: "linear", // |
|
|
228 |
rotation: 90, |
|
|
229 |
stops: [ |
|
|
230 |
{color: "#562A0D", opacity: 1, offset: 0}, |
|
|
231 |
{color: "#68340F", opacity: 1, offset: 1} |
|
|
232 |
] |
|
|
233 |
} |
|
|
234 |
}); |
|
|
235 |
innerTopScroll.moveTo(200,200); |
|
|
236 |
innerTopScroll.moveTo(160,227); |
|
|
237 |
innerTopScroll.curveTo(143,206,142,156,190,156); |
|
|
238 |
innerTopScroll.curveTo(236,164,226,215,198,219); |
|
|
239 |
innerTopScroll.curveTo(185,220,165,211,178,190); |
|
|
240 |
innerTopScroll.curveTo(182,216,210,205,204,188); |
|
|
241 |
|
|
|
242 |
//Highlight line along the top of the head |
|
|
243 |
var base_high = mygraphic.addShape({ |
|
|
244 |
type: "path", |
|
|
245 |
stroke: { |
|
|
246 |
weight: 2, |
|
|
247 |
color: "#fff", |
|
|
248 |
opacity: 0.1//, dashstyle: [3, 4] |
|
|
249 |
} |
|
|
250 |
}); |
|
|
251 |
base_high.moveTo(503,207); |
|
|
252 |
base_high.curveTo(428,188,354,182,292,221); |
|
|
253 |
base_high.curveTo(270,233,242,252,217,258); |
|
|
254 |
base_high.lineTo(209,254); |
|
|
255 |
base_high.end(); |
|
|
256 |
|
|
|
257 |
//Highlight along the spiral and lower edge of the violin head and neck |
|
|
258 |
var headLine = mygraphic.addShape({ |
|
|
259 |
type: "path", |
|
|
260 |
stroke: { |
|
|
261 |
weight: 4, |
|
|
262 |
color: "#fff", |
|
|
263 |
opacity: 0.1 |
|
|
264 |
} |
|
|
265 |
}); |
|
|
266 |
headLine.moveTo(614,278); |
|
|
267 |
headLine.lineTo(553,263); |
|
|
268 |
headLine.curveTo(516,255,503,283,500,300); |
|
|
269 |
headLine.lineTo(496,318); |
|
|
270 |
headLine.curveTo(496,323,488,323,486,318); |
|
|
271 |
headLine.curveTo(405,233,310,332,218,321); |
|
|
272 |
headLine.curveTo(149,320,101,270,99,217); |
|
|
273 |
headLine.curveTo(96,182,120,143,141,132); |
|
|
274 |
headLine.curveTo(162,116,199,116,223,131); |
|
|
275 |
headLine.curveTo(242,140,260,170,253,202); |
|
|
276 |
headLine.curveTo(249,228,230,240,213,244); |
|
|
277 |
headLine.moveTo(216,244); |
|
|
278 |
headLine.curveTo(180,248,154,236,148,204); |
|
|
279 |
headLine.curveTo(143,185,153,157,184,154); |
|
|
280 |
headLine.curveTo(209,152,227,171,222,197); |
|
|
281 |
headLine.curveTo(219,224,180,229,172,205); |
|
|
282 |
headLine.curveTo(167,201,174,186,181,187); |
|
|
283 |
headLine.end(); |
|
|
284 |
|
|
|
285 |
//create an ellipse for the fiddle head dot |
|
|
286 |
var fiddleHeadDot = mygraphic.addShape({ |
|
|
287 |
type: "ellipse", |
|
|
288 |
fill: { |
|
|
289 |
color: "#fff", |
|
|
290 |
opacity: 0.1 |
|
|
291 |
}, |
|
|
292 |
stroke: { |
|
|
293 |
weight: 0, |
|
|
294 |
color: "#000" |
|
|
295 |
}, |
|
|
296 |
width: 25, |
|
|
297 |
height: 25, |
|
|
298 |
x: 178, |
|
|
299 |
y: 178 |
|
|
300 |
}); |
|
|
301 |
|
|
|
302 |
//shared properties for the shadows |
|
|
303 |
var shadowConfig = { |
|
|
304 |
type: "path", |
|
|
305 |
stroke: { |
|
|
306 |
weight: 0, |
|
|
307 |
color: "#000", |
|
|
308 |
opacity: 1 |
|
|
309 |
}, |
|
|
310 |
fill: { |
|
|
311 |
type: "linear", |
|
|
312 |
rotation: 60, |
|
|
313 |
stops: [ |
|
|
314 |
{color: "#000", opacity: 1, offset: 0}, |
|
|
315 |
{color: "#241105", opacity: 1, offset: 0.8} |
|
|
316 |
] |
|
|
317 |
} |
|
|
318 |
} |
|
|
319 |
|
|
|
320 |
//Shadow for inner spiral on the top of the head |
|
|
321 |
var innerSpiralFiddleHeadShadow = mygraphic.addShape(shadowConfig); // at center of fiddle head |
|
|
322 |
innerSpiralFiddleHeadShadow.moveTo(204,188); |
|
|
323 |
innerSpiralFiddleHeadShadow.curveTo(207,211,179,206,178,194); |
|
|
324 |
innerSpiralFiddleHeadShadow.curveTo(166,215,219,229,204,190); |
|
|
325 |
innerSpiralFiddleHeadShadow.end(); |
|
|
326 |
|
|
|
327 |
//Shadow for middle spiral on the top of the head |
|
|
328 |
var middleSpiralFiddleHeadShadow = mygraphic.addShape(shadowConfig); |
|
|
329 |
middleSpiralFiddleHeadShadow.moveTo(223,172); |
|
|
330 |
middleSpiralFiddleHeadShadow.curveTo(239,224,186,233,173,213); |
|
|
331 |
middleSpiralFiddleHeadShadow.curveTo(174,266,257,223,222,171); |
|
|
332 |
middleSpiralFiddleHeadShadow.end(); |
|
|
333 |
|
|
|
334 |
//Shadow for outer spiral on the top of the head |
|
|
335 |
var outerSpiralFiddleHeadShadow = mygraphic.addShape(shadowConfig); |
|
|
336 |
outerSpiralFiddleHeadShadow.moveTo(148,214); |
|
|
337 |
outerSpiralFiddleHeadShadow.curveTo(158,242,186,250,218,246); |
|
|
338 |
outerSpiralFiddleHeadShadow.lineTo(221,253); |
|
|
339 |
outerSpiralFiddleHeadShadow.curveTo(178,258,154,241,147,214); |
|
|
340 |
outerSpiralFiddleHeadShadow.end(); |
|
|
341 |
|
|
|
342 |
//Shadow beneath the left tuning key |
|
|
343 |
var leftTuningKeyShadow = mygraphic.addShape(shadowConfig); |
|
|
344 |
leftTuningKeyShadow.moveTo(293,286); |
|
|
345 |
leftTuningKeyShadow.lineTo(323,277); |
|
|
346 |
leftTuningKeyShadow.lineTo(337,289); |
|
|
347 |
leftTuningKeyShadow.lineTo(336,293); |
|
|
348 |
leftTuningKeyShadow.lineTo(292,307); |
|
|
349 |
leftTuningKeyShadow.lineTo(288,294); |
|
|
350 |
leftTuningKeyShadow.lineTo(292,285); |
|
|
351 |
leftTuningKeyShadow.end(); |
|
|
352 |
|
|
|
353 |
//Shadow beneath the right tuning key |
|
|
354 |
var rightTuningKeyShadow = mygraphic.addShape(shadowConfig); |
|
|
355 |
rightTuningKeyShadow.moveTo(441,260); |
|
|
356 |
rightTuningKeyShadow.lineTo(440,276); |
|
|
357 |
rightTuningKeyShadow.lineTo(436,283); |
|
|
358 |
rightTuningKeyShadow.curveTo(453,286,474,299,492,319); |
|
|
359 |
rightTuningKeyShadow.curveTo(497,308,497,299,498,297); |
|
|
360 |
rightTuningKeyShadow.lineTo(492,278); |
|
|
361 |
rightTuningKeyShadow.lineTo(483,267); |
|
|
362 |
rightTuningKeyShadow.lineTo(468,254); |
|
|
363 |
rightTuningKeyShadow.lineTo(440,260); |
|
|
364 |
rightTuningKeyShadow.end(); |
|
|
365 |
|
|
|
366 |
//Shadow beneath the left dowel |
|
|
367 |
var leftDowelShadow = mygraphic.addShape(shadowConfig); |
|
|
368 |
leftDowelShadow.moveTo(230,284); |
|
|
369 |
leftDowelShadow.lineTo(251,280); |
|
|
370 |
leftDowelShadow.curveTo(257,308,230,301,229,283); |
|
|
371 |
leftDowelShadow.end(); |
|
|
372 |
|
|
|
373 |
//Shadow beneath the right dowel |
|
|
374 |
var rightDowelShadow = mygraphic.addShape(shadowConfig); |
|
|
375 |
rightDowelShadow.moveTo(377,246); |
|
|
376 |
rightDowelShadow.lineTo(399,242); |
|
|
377 |
rightDowelShadow.curveTo(402,261,383,263,376,246); |
|
|
378 |
rightDowelShadow.end(); |
|
|
379 |
|
|
|
380 |
//Add transparent gradients for the woodgrain if the browser supports gradient transparency |
|
|
381 |
var DOCUMENT = Y.config.doc, |
|
|
382 |
canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
|
383 |
|
|
|
384 |
if(DOCUMENT && (DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") || (canvas && canvas.getContext && canvas.getContext("2d")))) |
|
|
385 |
{ |
|
|
386 |
var headWoodgrain = mygraphic.addShape({ |
|
|
387 |
type: "path", |
|
|
388 |
stroke: { |
|
|
389 |
weight: 0, |
|
|
390 |
color: "#f00", |
|
|
391 |
opacity: 1 |
|
|
392 |
}, |
|
|
393 |
fill: { |
|
|
394 |
type: "linear", |
|
|
395 |
rotation: 5, |
|
|
396 |
stops: [ |
|
|
397 |
{color: "#3B1E09", opacity: 1, offset: 0.03}, |
|
|
398 |
{color: "#9B4D17", opacity: 1, offset: 0.06}, |
|
|
399 |
{color: "#3B1E09", opacity: 1, offset: 0.09}, |
|
|
400 |
{color: "#9B4D17", opacity: 1, offset: 0.12}, |
|
|
401 |
{color: "#3B1E09", opacity: 1, offset: 0.18}, |
|
|
402 |
{color: "#9B4D17", opacity: 1, offset: 0.20}, |
|
|
403 |
{color: "#3B1E09", opacity: 1, offset: 0.23}, |
|
|
404 |
{color: "#9B4D17", opacity: 1, offset: 0.29}, |
|
|
405 |
{color: "#3B1E09", opacity: 1, offset: 0.34}, |
|
|
406 |
{color: "#9B4D17", opacity: 1, offset: 0.36}, |
|
|
407 |
{color: "#3B1E09", opacity: 1, offset: 0.38}, |
|
|
408 |
{color: "#9B4D17", opacity: 1, offset: 0.40}, |
|
|
409 |
{color: "#3B1E09", opacity: 1, offset: 0.45}, |
|
|
410 |
{color: "#9B4D17", opacity: 1, offset: 0.48}, |
|
|
411 |
{color: "#3B1E09", opacity: 1, offset: 0.50}, |
|
|
412 |
{color: "#9B4D17", opacity: 1, offset: 0.52}, |
|
|
413 |
{color: "#3B1E09", opacity: 1, offset: 0.55}, |
|
|
414 |
{color: "#9B4D17", opacity: 1, offset: 0.62}, |
|
|
415 |
{color: "#3B1E09", opacity: 1, offset: 0.68}, |
|
|
416 |
{color: "#9B4D17", opacity: 1, offset: 0.73}, |
|
|
417 |
{color: "#3B1E09", opacity: 1, offset: 0.76}, |
|
|
418 |
{color: "#9B4D17", opacity: 1, offset: 0.78}, |
|
|
419 |
{color: "#3B1E09", opacity: 1, offset: 0.82}, |
|
|
420 |
{color: "#9B4D17", opacity: 1, offset: 0.86}, |
|
|
421 |
{color: "#3B1E09", opacity: 1, offset: 0.90}, |
|
|
422 |
{color: "#9B4D17", opacity: 1, offset: 0.94}, |
|
|
423 |
{color: "#3B1E09", opacity: 1, offset: 0.96}, |
|
|
424 |
{color: "#9B4D17", opacity: 1, offset: 1} |
|
|
425 |
] |
|
|
426 |
} |
|
|
427 |
}); |
|
|
428 |
|
|
|
429 |
//Draw the woodgrain |
|
|
430 |
headWoodgrain.moveTo(614,278); |
|
|
431 |
headWoodgrain.lineTo(553,263); |
|
|
432 |
headWoodgrain.curveTo(516,255,503,283,500,300); |
|
|
433 |
headWoodgrain.lineTo(496,318); |
|
|
434 |
headWoodgrain.curveTo(496,323,488,323,486,318); |
|
|
435 |
headWoodgrain.curveTo(405,233,310,332,218,321); |
|
|
436 |
headWoodgrain.curveTo(149,320,101,270,99,217); |
|
|
437 |
headWoodgrain.curveTo(96,182,120,143,141,132); |
|
|
438 |
headWoodgrain.curveTo(162,116,199,116,223,131); |
|
|
439 |
headWoodgrain.curveTo(242,140,260,170,253,202); |
|
|
440 |
headWoodgrain.curveTo(249,228,230,242,213,246); |
|
|
441 |
headWoodgrain.curveTo(214,249,218,257,235,246); |
|
|
442 |
headWoodgrain.curveTo(254,233,299,209,324,199); |
|
|
443 |
headWoodgrain.curveTo(369,182,428,185,470,195); |
|
|
444 |
headWoodgrain.lineTo(505,204); |
|
|
445 |
headWoodgrain.lineTo(506,203); |
|
|
446 |
headWoodgrain.lineTo(614,231); |
|
|
447 |
headWoodgrain.end(); |
|
|
448 |
|
|
|
449 |
//handle for adding opacity to the whole object. |
|
|
450 |
headWoodgrain.addClass('woodgrain'); |
|
|
451 |
} |
|
|
452 |
|
|
|
453 |
//The bushing for the left tuning key |
|
|
454 |
var nob_bushing_left = mygraphic.addShape({ |
|
|
455 |
type: "ellipse", |
|
|
456 |
stroke: { |
|
|
457 |
weight: 0, |
|
|
458 |
color: "#00dd00", |
|
|
459 |
opacity: 1 |
|
|
460 |
}, |
|
|
461 |
fill: { |
|
|
462 |
type: "radial", |
|
|
463 |
stops: [ |
|
|
464 |
{color: "#000", opacity: 1, offset: 0}, |
|
|
465 |
{color: "#000", opacity: 1, offset: 0.7}, |
|
|
466 |
{color: "#282622", opacity: 1, offset: 0.8}, |
|
|
467 |
{color: "#000", opacity: 1, offset: 0.9} |
|
|
468 |
], |
|
|
469 |
cx: 0.45, |
|
|
470 |
cy: 0.45, |
|
|
471 |
fx: 0.9, |
|
|
472 |
fy: 0.9, |
|
|
473 |
r: 0.6 |
|
|
474 |
}, |
|
|
475 |
width: 52, |
|
|
476 |
height: 52, |
|
|
477 |
x: 277, |
|
|
478 |
y: 240 |
|
|
479 |
}); |
|
|
480 |
|
|
|
481 |
//The bushing for the right tuning key |
|
|
482 |
var nob_bushing_right = mygraphic.addShape({ |
|
|
483 |
type: "ellipse", |
|
|
484 |
stroke: { |
|
|
485 |
weight: 0, |
|
|
486 |
color: "#00dd00", |
|
|
487 |
opacity: 1 |
|
|
488 |
}, |
|
|
489 |
fill: { |
|
|
490 |
type: "radial", |
|
|
491 |
stops: [ |
|
|
492 |
{color: "#000", opacity: 1, offset: 0}, |
|
|
493 |
{color: "#000", opacity: 1, offset: 0.7}, |
|
|
494 |
{color: "#282622", opacity: 1, offset: 0.8}, |
|
|
495 |
{color: "#000", opacity: 1, offset: 0.9} |
|
|
496 |
], |
|
|
497 |
cx: 0.45, |
|
|
498 |
cy: 0.45, |
|
|
499 |
fx: 0.9, |
|
|
500 |
fy: 0.9, |
|
|
501 |
r: 0.6 |
|
|
502 |
}, |
|
|
503 |
width: 52, |
|
|
504 |
height: 52, |
|
|
505 |
x: 429, |
|
|
506 |
y: 217 |
|
|
507 |
}); |
|
|
508 |
|
|
|
509 |
var leftTuningKeySides = mygraphic.addShape({ |
|
|
510 |
type: "path", |
|
|
511 |
stroke: { |
|
|
512 |
weight: 0, |
|
|
513 |
color: "#00dd00", |
|
|
514 |
opacity: 1 |
|
|
515 |
}, |
|
|
516 |
fill: { |
|
|
517 |
type: "radial", |
|
|
518 |
stops: [ |
|
|
519 |
{color: "#73371F", opacity: 1, offset: 0}, |
|
|
520 |
{color: "#35211B", opacity: 1, offset: 1} |
|
|
521 |
] |
|
|
522 |
} |
|
|
523 |
}); |
|
|
524 |
leftTuningKeySides.moveTo(318,231); |
|
|
525 |
leftTuningKeySides.curveTo(333,227,344,237,336,252); |
|
|
526 |
leftTuningKeySides.lineTo(335,253); |
|
|
527 |
leftTuningKeySides.curveTo(326,267,297,294,286,300); |
|
|
528 |
leftTuningKeySides.curveTo(281,305,262,295,266,283); |
|
|
529 |
leftTuningKeySides.curveTo(278,266,306,245,313,234); |
|
|
530 |
leftTuningKeySides.end(); |
|
|
531 |
|
|
|
532 |
var rightTuningKeySides = mygraphic.addShape({ |
|
|
533 |
type: "path", |
|
|
534 |
stroke: { |
|
|
535 |
weight: 0, |
|
|
536 |
color: "#00dd00", |
|
|
537 |
opacity: 1 |
|
|
538 |
}, |
|
|
539 |
fill: { |
|
|
540 |
type: "radial", |
|
|
541 |
stops: [ |
|
|
542 |
{color: "#73371F", opacity: 1, offset: 0}, |
|
|
543 |
{color: "#35211B", opacity: 1, offset: 1} |
|
|
544 |
] |
|
|
545 |
} |
|
|
546 |
}); |
|
|
547 |
|
|
|
548 |
rightTuningKeySides.moveTo(476,214); |
|
|
549 |
rightTuningKeySides.curveTo(492,206,504,229,494,238); |
|
|
550 |
rightTuningKeySides.curveTo(482,247,455,265,432,271); |
|
|
551 |
rightTuningKeySides.curveTo(422,275,403,262,420,244); |
|
|
552 |
rightTuningKeySides.curveTo(430,235,463,224,476,214); |
|
|
553 |
rightTuningKeySides.end(); |
|
|
554 |
|
|
|
555 |
//Shared attributes for tuning key edges |
|
|
556 |
var tuningKeyBevelStyle = { |
|
|
557 |
type: "path", |
|
|
558 |
stroke: { |
|
|
559 |
weight: 0, |
|
|
560 |
color: "#00dd00", |
|
|
561 |
opacity: 1 |
|
|
562 |
}, |
|
|
563 |
fill: { |
|
|
564 |
type: "radial", |
|
|
565 |
stops: [ |
|
|
566 |
{color: "#DB8C64", opacity: 1, offset: 0}, |
|
|
567 |
{color: "#593123", opacity: 1, offset: 0.5}, |
|
|
568 |
{color: "#231610", opacity: 1, offset: 1} |
|
|
569 |
], |
|
|
570 |
cx: 0.5, |
|
|
571 |
cy: 0.5, |
|
|
572 |
fx: 0.3, |
|
|
573 |
fy: 0.2, |
|
|
574 |
r: 0.5 |
|
|
575 |
} |
|
|
576 |
}; |
|
|
577 |
|
|
|
578 |
//bevel for the right side tuning key |
|
|
579 |
var leftTuningKeyBevel = mygraphic.addShape(tuningKeyBevelStyle); |
|
|
580 |
leftTuningKeyBevel.moveTo(318,236); |
|
|
581 |
leftTuningKeyBevel.curveTo(324,219,345,249,336,249); |
|
|
582 |
leftTuningKeyBevel.curveTo(316,263,292,286,282,301); |
|
|
583 |
leftTuningKeyBevel.curveTo(282,304,264,295,266,285); |
|
|
584 |
leftTuningKeyBevel.curveTo(273,279,313,247,317,237); |
|
|
585 |
leftTuningKeyBevel.end(); |
|
|
586 |
|
|
|
587 |
//bevel for the right side tuning key |
|
|
588 |
var rightTuningKeyBevel = mygraphic.addShape(tuningKeyBevelStyle); |
|
|
589 |
rightTuningKeyBevel.moveTo(477,215); |
|
|
590 |
rightTuningKeyBevel.curveTo(495,205,506,240,494,238); |
|
|
591 |
rightTuningKeyBevel.curveTo(481,246,443,268,428,272); |
|
|
592 |
rightTuningKeyBevel.curveTo(421,274,407,256,417,248); |
|
|
593 |
rightTuningKeyBevel.curveTo(413,253,466,234,477,215); |
|
|
594 |
rightTuningKeyBevel.end(); |
|
|
595 |
|
|
|
596 |
//Add an ellipse for the dowel of the left (opposite side) tuning key |
|
|
597 |
var nobdowel_left = mygraphic.addShape({ |
|
|
598 |
type: "ellipse", |
|
|
599 |
stroke: { |
|
|
600 |
weight: 0, |
|
|
601 |
color: "#00dd00", |
|
|
602 |
opacity: 1 |
|
|
603 |
}, |
|
|
604 |
fill: { |
|
|
605 |
type: "radial", |
|
|
606 |
stops: [ |
|
|
607 |
{color: "#8E5B40", opacity: 1, offset: 0}, |
|
|
608 |
{color: "#593123", opacity: 1, offset: 0.3}, |
|
|
609 |
{color: "#231610", opacity: 1, offset: 1} |
|
|
610 |
], |
|
|
611 |
cx: 0.5, |
|
|
612 |
cy: 0.5, |
|
|
613 |
fx: 0.3, |
|
|
614 |
fy: 0.2, |
|
|
615 |
r: 0.5 |
|
|
616 |
}, |
|
|
617 |
width: 24, |
|
|
618 |
height: 24, |
|
|
619 |
x: 228, |
|
|
620 |
y: 268 |
|
|
621 |
}); |
|
|
622 |
|
|
|
623 |
//Add an ellipse for the dowel of the right (opposite side) tuning key |
|
|
624 |
var nobdowel_right = mygraphic.addShape({ |
|
|
625 |
type: "ellipse", |
|
|
626 |
stroke: { |
|
|
627 |
weight: 0, |
|
|
628 |
color: "#00dd00", |
|
|
629 |
opacity: 1 |
|
|
630 |
}, |
|
|
631 |
fill: { |
|
|
632 |
type: "radial", |
|
|
633 |
stops: [ |
|
|
634 |
{color: "#8E5B40", opacity: 1, offset: 0}, |
|
|
635 |
{color: "#593123", opacity: 1, offset: 0.3}, |
|
|
636 |
{color: "#231610", opacity: 1, offset: 1} |
|
|
637 |
], |
|
|
638 |
cx: 0.5, |
|
|
639 |
cy: 0.5, |
|
|
640 |
fx: 0.3, |
|
|
641 |
fy: 0.2, |
|
|
642 |
r: 0.5 |
|
|
643 |
}, |
|
|
644 |
width: 24, |
|
|
645 |
height: 24, |
|
|
646 |
x: 374, |
|
|
647 |
y: 227 |
|
|
648 |
}); |
|
|
649 |
|
|
|
650 |
//Add an ellipse for the black tip of the left tuning key |
|
|
651 |
var nob_tip_left = mygraphic.addShape({ |
|
|
652 |
type: "ellipse", |
|
|
653 |
stroke: { |
|
|
654 |
weight: 2, |
|
|
655 |
color: "#332017", |
|
|
656 |
opacity: 0.8 |
|
|
657 |
}, |
|
|
658 |
fill: { |
|
|
659 |
type: "radial", |
|
|
660 |
stops: [ |
|
|
661 |
{color: "#808080", opacity: 1, offset: 0}, |
|
|
662 |
{color: "#000", opacity: 1, offset: 0.3}, |
|
|
663 |
{color: "#000", opacity: 1, offset: 1} |
|
|
664 |
], |
|
|
665 |
cx: 0.5, |
|
|
666 |
cy: 0.5, |
|
|
667 |
fx: 0.3, |
|
|
668 |
fy: 0.2, |
|
|
669 |
r: 0.5 |
|
|
670 |
}, |
|
|
671 |
width: 12, |
|
|
672 |
height: 12, |
|
|
673 |
x: 297, |
|
|
674 |
y: 261 |
|
|
675 |
}); |
|
|
676 |
|
|
|
677 |
//Add an ellipse for the black tip of the right tuning key |
|
|
678 |
var nob_tip_right = mygraphic.addShape({ |
|
|
679 |
type: "ellipse", |
|
|
680 |
stroke: { |
|
|
681 |
weight: 2, |
|
|
682 |
color: "#332017", |
|
|
683 |
opacity: 0.8 |
|
|
684 |
}, |
|
|
685 |
fill: { |
|
|
686 |
type: "radial", |
|
|
687 |
stops: [ |
|
|
688 |
{color: "#808080", opacity: 1, offset: 0}, |
|
|
689 |
{color: "#000", opacity: 1, offset: 0.5}, |
|
|
690 |
{color: "#000", opacity: 1, offset: 1} |
|
|
691 |
], |
|
|
692 |
cx: 0.5, |
|
|
693 |
cy: 0.5, |
|
|
694 |
fx: 0.3, |
|
|
695 |
fy: 0.2, |
|
|
696 |
r: 0.5 |
|
|
697 |
}, |
|
|
698 |
width: 12, |
|
|
699 |
height: 12, |
|
|
700 |
x: 450, |
|
|
701 |
y: 238 |
|
|
702 |
}); |
|
|
703 |
}); |
|
|
704 |
</script> |
|
|
705 |
|
|
|
706 |
</div> |
|
|
707 |
|
|
|
708 |
<h2>Path Drawing Tool</h2> |
|
|
709 |
<!-- doesn't contain the header because it may be h3 or h2 --> |
|
|
710 |
<p> |
|
|
711 |
<div style="float:right; margin: 6px 0 8px 8px;"> |
|
|
712 |
<a href="graphics-path-tool.html"> |
|
|
713 |
<img style="border: 1px solid #bfbfbf; height:149px; width:395px;" alt="Screen capture of Graphics path tool" src="../assets/graphics/img/path-tool-capture.png"> |
|
|
714 |
|
|
|
715 |
</a> |
|
|
716 |
<div> |
|
|
717 |
<a href="graphics-path-tool.html" class="button">Read More</a> |
|
|
718 |
</div> |
|
|
719 |
</div> |
|
|
720 |
Try this simple <a href="graphics-path-tool.html">tool</a> that helps you by generating code while you interactively |
|
|
721 |
draw graphic paths. |
|
|
722 |
</p> |
|
|
723 |
<p> |
|
|
724 |
As you drag the pencil icon, corresponding graphics code is auto-generated. |
|
|
725 |
This code can be copied and pasted into a graphics instance to reproduce |
|
|
726 |
the paths you created with the pencil. |
|
|
727 |
</p> |
|
|
728 |
<p> |
|
|
729 |
The <a href="graphics-violin.html">violin example</a> was created with this tool. |
|
|
730 |
</p> |
|
|
731 |
|
|
|
732 |
|
|
|
733 |
<h2>HTML</h2> |
|
|
734 |
<pre class="code prettyprint"><div id="#outerframe"> |
|
|
735 |
<div id="mygraphiccontainer"></div> |
|
|
736 |
</div></pre> |
|
|
737 |
|
|
|
738 |
|
|
|
739 |
<h2>CSS</h2> |
|
|
740 |
<pre class="code prettyprint">#outerframe { |
|
|
741 |
display: inline-block; |
|
|
742 |
height: 446px; |
|
|
743 |
width: 714px; |
|
|
744 |
} |
|
|
745 |
|
|
|
746 |
#mygraphiccontainer { |
|
|
747 |
display: inline-block; |
|
|
748 |
top: 100px; |
|
|
749 |
width: 614px; |
|
|
750 |
top: 15px; |
|
|
751 |
left: 34px; |
|
|
752 |
position: relative; |
|
|
753 |
} |
|
|
754 |
.woodgrain{ |
|
|
755 |
opacity:0.2; |
|
|
756 |
filter:alpha(opacity=20); |
|
|
757 |
}</pre> |
|
|
758 |
|
|
|
759 |
|
|
|
760 |
<h2>Complete Example Source</h2> |
|
|
761 |
<pre class="code prettyprint"><div id="outerframe"> |
|
|
762 |
<div id="mygraphiccontainer"></div> |
|
|
763 |
</div> |
|
|
764 |
<script> |
|
|
765 |
YUI().use('graphics', function (Y) |
|
|
766 |
{ |
|
|
767 |
//create a graphic instance |
|
|
768 |
var mygraphic = new Y.Graphic(); |
|
|
769 |
mygraphic.render("#mygraphiccontainer"); |
|
|
770 |
|
|
|
771 |
//draw a background |
|
|
772 |
var background = mygraphic.addShape({ |
|
|
773 |
type: "rect", |
|
|
774 |
stroke: { |
|
|
775 |
weight: 0, |
|
|
776 |
color: "#f00", |
|
|
777 |
opacity: 0 |
|
|
778 |
}, |
|
|
779 |
fill: { |
|
|
780 |
type: "radial", |
|
|
781 |
stops: [ |
|
|
782 |
{color: "#001000", opacity: 1, offset: 0}, |
|
|
783 |
{color: "#000", opacity: 1, offset: 1} |
|
|
784 |
] |
|
|
785 |
}, |
|
|
786 |
width: 614, |
|
|
787 |
height: 397, |
|
|
788 |
x: 0, |
|
|
789 |
y: 0 |
|
|
790 |
}); |
|
|
791 |
|
|
|
792 |
//create a path element to use for the strings |
|
|
793 |
var strings = mygraphic.addShape({ |
|
|
794 |
type: "path", |
|
|
795 |
stroke: { |
|
|
796 |
weight: 2, |
|
|
797 |
color: "#bbb" |
|
|
798 |
} |
|
|
799 |
}); |
|
|
800 |
|
|
|
801 |
//draw strings |
|
|
802 |
strings.moveTo(614,199); |
|
|
803 |
strings.lineTo(536,181); |
|
|
804 |
strings.curveTo(532,178,519,181,515,183); |
|
|
805 |
strings.lineTo(465,197); |
|
|
806 |
strings.lineTo(487,203); |
|
|
807 |
strings.lineTo(515,187); |
|
|
808 |
strings.curveTo(519,184,529,182,536,184); |
|
|
809 |
strings.lineTo(613,202); |
|
|
810 |
strings.end(); |
|
|
811 |
|
|
|
812 |
//create a path element to use for the fingerboard |
|
|
813 |
var finger_board = mygraphic.addShape({ |
|
|
814 |
type: "path", |
|
|
815 |
stroke: { |
|
|
816 |
weight: 1, |
|
|
817 |
color: "#f00", |
|
|
818 |
opacity: 0 |
|
|
819 |
}, |
|
|
820 |
fill: { |
|
|
821 |
type: "linear", |
|
|
822 |
rotation: 140, |
|
|
823 |
stops: [ |
|
|
824 |
{color: "#000", opacity: 1, offset: 0}, |
|
|
825 |
{color: "#000", opacity: 1, offset: 0.2}, |
|
|
826 |
{color: "#302420", opacity: 1, offset: 0.8} |
|
|
827 |
] |
|
|
828 |
} |
|
|
829 |
}); |
|
|
830 |
|
|
|
831 |
//draw the fingerboard |
|
|
832 |
finger_board.moveTo(613,231); |
|
|
833 |
finger_board.lineTo(507,204); |
|
|
834 |
finger_board.curveTo(506,186,527,183,533,186); |
|
|
835 |
finger_board.lineTo(613,205); |
|
|
836 |
finger_board.end(); |
|
|
837 |
|
|
|
838 |
//Highlight for the fingerboard |
|
|
839 |
var fingerboard_high = mygraphic.addShape({ |
|
|
840 |
type: "path", |
|
|
841 |
stroke: { |
|
|
842 |
weight: 1, |
|
|
843 |
color: "#555", //, dashstyle: [3, 4] |
|
|
844 |
opacity: 0.5 |
|
|
845 |
} |
|
|
846 |
}); |
|
|
847 |
|
|
|
848 |
fingerboard_high.moveTo(512,199); |
|
|
849 |
fingerboard_high.curveTo(517,193,527,190,534,191); |
|
|
850 |
fingerboard_high.end(); |
|
|
851 |
|
|
|
852 |
//Create a path to use for the headstock |
|
|
853 |
var head = mygraphic.addShape({ |
|
|
854 |
type: "path", |
|
|
855 |
stroke: { |
|
|
856 |
weight: 0, |
|
|
857 |
color: "#f00", |
|
|
858 |
opacity: 1 //, |
|
|
859 |
//dashstyle: [3, 4] |
|
|
860 |
}, |
|
|
861 |
fill: { |
|
|
862 |
type: "linear", |
|
|
863 |
rotation: 60, |
|
|
864 |
stops: [ |
|
|
865 |
{color: "#9B4D17", opacity: 1, offset: 0}, |
|
|
866 |
{color: "#3B1E09", opacity: 1, offset: 0.8} |
|
|
867 |
] |
|
|
868 |
} |
|
|
869 |
}); |
|
|
870 |
|
|
|
871 |
//Draw the headstock |
|
|
872 |
head.moveTo(614,278); |
|
|
873 |
head.lineTo(553,263); |
|
|
874 |
head.curveTo(516,255,503,283,500,300); |
|
|
875 |
head.lineTo(496,318); |
|
|
876 |
head.curveTo(496,323,488,323,486,318); |
|
|
877 |
head.curveTo(405,233,310,332,218,321); |
|
|
878 |
head.curveTo(149,320,101,270,99,217); |
|
|
879 |
head.curveTo(96,182,120,143,141,132); |
|
|
880 |
head.curveTo(162,116,199,116,223,131); |
|
|
881 |
head.curveTo(242,140,260,170,253,202); |
|
|
882 |
head.curveTo(249,228,230,242,213,246); |
|
|
883 |
head.curveTo(214,249,218,257,235,246); |
|
|
884 |
head.curveTo(254,233,299,209,324,199); |
|
|
885 |
head.curveTo(369,182,428,185,470,195); |
|
|
886 |
head.lineTo(505,204); |
|
|
887 |
head.lineTo(506,203); |
|
|
888 |
head.lineTo(614,231); |
|
|
889 |
head.end(); |
|
|
890 |
|
|
|
891 |
//Outer portion of the spiral on top of the head |
|
|
892 |
var outerTopScroll = mygraphic.addShape({ //outter top scroll |
|
|
893 |
type: "path", |
|
|
894 |
stroke: { |
|
|
895 |
weight: 0, |
|
|
896 |
color: "#00dd00", // , dashstyle: [3, 4] |
|
|
897 |
opacity: 1 |
|
|
898 |
}, |
|
|
899 |
fill: { |
|
|
900 |
type: "linear", // |
|
|
901 |
rotation: 90, |
|
|
902 |
stops: [ |
|
|
903 |
{color: "#562A0D", opacity: 1, offset: 0}, |
|
|
904 |
{color: "#68340F", opacity: 1, offset: 1} |
|
|
905 |
] |
|
|
906 |
} |
|
|
907 |
}); |
|
|
908 |
outerTopScroll.moveTo(106,229); |
|
|
909 |
outerTopScroll.curveTo(104,190,116,154,144,137); |
|
|
910 |
outerTopScroll.curveTo(169,121,214,121,237,150); |
|
|
911 |
outerTopScroll.curveTo(251,173,258,209,229,230); |
|
|
912 |
outerTopScroll.lineTo(219,227); |
|
|
913 |
outerTopScroll.curveTo(219,212,237,170,210,157); |
|
|
914 |
outerTopScroll.curveTo(175,134,132,167,146,216); |
|
|
915 |
outerTopScroll.curveTo(147,220,152,232,156,234); |
|
|
916 |
outerTopScroll.lineTo(105,229); |
|
|
917 |
outerTopScroll.end(); |
|
|
918 |
|
|
|
919 |
//Inner portion of the spiral on top of the head |
|
|
920 |
var innerTopScroll = mygraphic.addShape({ // inner top scroll |
|
|
921 |
type: "path", |
|
|
922 |
stroke: { |
|
|
923 |
weight: 0, |
|
|
924 |
color: "#00dd00", // , dashstyle: [3, 4] |
|
|
925 |
opacity: 1 |
|
|
926 |
}, |
|
|
927 |
fill: { |
|
|
928 |
type: "linear", // |
|
|
929 |
rotation: 90, |
|
|
930 |
stops: [ |
|
|
931 |
{color: "#562A0D", opacity: 1, offset: 0}, |
|
|
932 |
{color: "#68340F", opacity: 1, offset: 1} |
|
|
933 |
] |
|
|
934 |
} |
|
|
935 |
}); |
|
|
936 |
innerTopScroll.moveTo(200,200); |
|
|
937 |
innerTopScroll.moveTo(160,227); |
|
|
938 |
innerTopScroll.curveTo(143,206,142,156,190,156); |
|
|
939 |
innerTopScroll.curveTo(236,164,226,215,198,219); |
|
|
940 |
innerTopScroll.curveTo(185,220,165,211,178,190); |
|
|
941 |
innerTopScroll.curveTo(182,216,210,205,204,188); |
|
|
942 |
|
|
|
943 |
//Highlight line along the top of the head |
|
|
944 |
var base_high = mygraphic.addShape({ |
|
|
945 |
type: "path", |
|
|
946 |
stroke: { |
|
|
947 |
weight: 2, |
|
|
948 |
color: "#fff", |
|
|
949 |
opacity: 0.1//, dashstyle: [3, 4] |
|
|
950 |
} |
|
|
951 |
}); |
|
|
952 |
base_high.moveTo(503,207); |
|
|
953 |
base_high.curveTo(428,188,354,182,292,221); |
|
|
954 |
base_high.curveTo(270,233,242,252,217,258); |
|
|
955 |
base_high.lineTo(209,254); |
|
|
956 |
base_high.end(); |
|
|
957 |
|
|
|
958 |
//Highlight along the spiral and lower edge of the violin head and neck |
|
|
959 |
var headLine = mygraphic.addShape({ |
|
|
960 |
type: "path", |
|
|
961 |
stroke: { |
|
|
962 |
weight: 4, |
|
|
963 |
color: "#fff", |
|
|
964 |
opacity: 0.1 |
|
|
965 |
} |
|
|
966 |
}); |
|
|
967 |
headLine.moveTo(614,278); |
|
|
968 |
headLine.lineTo(553,263); |
|
|
969 |
headLine.curveTo(516,255,503,283,500,300); |
|
|
970 |
headLine.lineTo(496,318); |
|
|
971 |
headLine.curveTo(496,323,488,323,486,318); |
|
|
972 |
headLine.curveTo(405,233,310,332,218,321); |
|
|
973 |
headLine.curveTo(149,320,101,270,99,217); |
|
|
974 |
headLine.curveTo(96,182,120,143,141,132); |
|
|
975 |
headLine.curveTo(162,116,199,116,223,131); |
|
|
976 |
headLine.curveTo(242,140,260,170,253,202); |
|
|
977 |
headLine.curveTo(249,228,230,240,213,244); |
|
|
978 |
headLine.moveTo(216,244); |
|
|
979 |
headLine.curveTo(180,248,154,236,148,204); |
|
|
980 |
headLine.curveTo(143,185,153,157,184,154); |
|
|
981 |
headLine.curveTo(209,152,227,171,222,197); |
|
|
982 |
headLine.curveTo(219,224,180,229,172,205); |
|
|
983 |
headLine.curveTo(167,201,174,186,181,187); |
|
|
984 |
headLine.end(); |
|
|
985 |
|
|
|
986 |
//create an ellipse for the fiddle head dot |
|
|
987 |
var fiddleHeadDot = mygraphic.addShape({ |
|
|
988 |
type: "ellipse", |
|
|
989 |
fill: { |
|
|
990 |
color: "#fff", |
|
|
991 |
opacity: 0.1 |
|
|
992 |
}, |
|
|
993 |
stroke: { |
|
|
994 |
weight: 0, |
|
|
995 |
color: "#000" |
|
|
996 |
}, |
|
|
997 |
width: 25, |
|
|
998 |
height: 25, |
|
|
999 |
x: 178, |
|
|
1000 |
y: 178 |
|
|
1001 |
}); |
|
|
1002 |
|
|
|
1003 |
//shared properties for the shadows |
|
|
1004 |
var shadowConfig = { |
|
|
1005 |
type: "path", |
|
|
1006 |
stroke: { |
|
|
1007 |
weight: 0, |
|
|
1008 |
color: "#000", |
|
|
1009 |
opacity: 1 |
|
|
1010 |
}, |
|
|
1011 |
fill: { |
|
|
1012 |
type: "linear", |
|
|
1013 |
rotation: 60, |
|
|
1014 |
stops: [ |
|
|
1015 |
{color: "#000", opacity: 1, offset: 0}, |
|
|
1016 |
{color: "#241105", opacity: 1, offset: 0.8} |
|
|
1017 |
] |
|
|
1018 |
} |
|
|
1019 |
} |
|
|
1020 |
|
|
|
1021 |
//Shadow for inner spiral on the top of the head |
|
|
1022 |
var innerSpiralFiddleHeadShadow = mygraphic.addShape(shadowConfig); // at center of fiddle head |
|
|
1023 |
innerSpiralFiddleHeadShadow.moveTo(204,188); |
|
|
1024 |
innerSpiralFiddleHeadShadow.curveTo(207,211,179,206,178,194); |
|
|
1025 |
innerSpiralFiddleHeadShadow.curveTo(166,215,219,229,204,190); |
|
|
1026 |
innerSpiralFiddleHeadShadow.end(); |
|
|
1027 |
|
|
|
1028 |
//Shadow for middle spiral on the top of the head |
|
|
1029 |
var middleSpiralFiddleHeadShadow = mygraphic.addShape(shadowConfig); |
|
|
1030 |
middleSpiralFiddleHeadShadow.moveTo(223,172); |
|
|
1031 |
middleSpiralFiddleHeadShadow.curveTo(239,224,186,233,173,213); |
|
|
1032 |
middleSpiralFiddleHeadShadow.curveTo(174,266,257,223,222,171); |
|
|
1033 |
middleSpiralFiddleHeadShadow.end(); |
|
|
1034 |
|
|
|
1035 |
//Shadow for outer spiral on the top of the head |
|
|
1036 |
var outerSpiralFiddleHeadShadow = mygraphic.addShape(shadowConfig); |
|
|
1037 |
outerSpiralFiddleHeadShadow.moveTo(148,214); |
|
|
1038 |
outerSpiralFiddleHeadShadow.curveTo(158,242,186,250,218,246); |
|
|
1039 |
outerSpiralFiddleHeadShadow.lineTo(221,253); |
|
|
1040 |
outerSpiralFiddleHeadShadow.curveTo(178,258,154,241,147,214); |
|
|
1041 |
outerSpiralFiddleHeadShadow.end(); |
|
|
1042 |
|
|
|
1043 |
//Shadow beneath the left tuning key |
|
|
1044 |
var leftTuningKeyShadow = mygraphic.addShape(shadowConfig); |
|
|
1045 |
leftTuningKeyShadow.moveTo(293,286); |
|
|
1046 |
leftTuningKeyShadow.lineTo(323,277); |
|
|
1047 |
leftTuningKeyShadow.lineTo(337,289); |
|
|
1048 |
leftTuningKeyShadow.lineTo(336,293); |
|
|
1049 |
leftTuningKeyShadow.lineTo(292,307); |
|
|
1050 |
leftTuningKeyShadow.lineTo(288,294); |
|
|
1051 |
leftTuningKeyShadow.lineTo(292,285); |
|
|
1052 |
leftTuningKeyShadow.end(); |
|
|
1053 |
|
|
|
1054 |
//Shadow beneath the right tuning key |
|
|
1055 |
var rightTuningKeyShadow = mygraphic.addShape(shadowConfig); |
|
|
1056 |
rightTuningKeyShadow.moveTo(441,260); |
|
|
1057 |
rightTuningKeyShadow.lineTo(440,276); |
|
|
1058 |
rightTuningKeyShadow.lineTo(436,283); |
|
|
1059 |
rightTuningKeyShadow.curveTo(453,286,474,299,492,319); |
|
|
1060 |
rightTuningKeyShadow.curveTo(497,308,497,299,498,297); |
|
|
1061 |
rightTuningKeyShadow.lineTo(492,278); |
|
|
1062 |
rightTuningKeyShadow.lineTo(483,267); |
|
|
1063 |
rightTuningKeyShadow.lineTo(468,254); |
|
|
1064 |
rightTuningKeyShadow.lineTo(440,260); |
|
|
1065 |
rightTuningKeyShadow.end(); |
|
|
1066 |
|
|
|
1067 |
//Shadow beneath the left dowel |
|
|
1068 |
var leftDowelShadow = mygraphic.addShape(shadowConfig); |
|
|
1069 |
leftDowelShadow.moveTo(230,284); |
|
|
1070 |
leftDowelShadow.lineTo(251,280); |
|
|
1071 |
leftDowelShadow.curveTo(257,308,230,301,229,283); |
|
|
1072 |
leftDowelShadow.end(); |
|
|
1073 |
|
|
|
1074 |
//Shadow beneath the right dowel |
|
|
1075 |
var rightDowelShadow = mygraphic.addShape(shadowConfig); |
|
|
1076 |
rightDowelShadow.moveTo(377,246); |
|
|
1077 |
rightDowelShadow.lineTo(399,242); |
|
|
1078 |
rightDowelShadow.curveTo(402,261,383,263,376,246); |
|
|
1079 |
rightDowelShadow.end(); |
|
|
1080 |
|
|
|
1081 |
//Add transparent gradients for the woodgrain if the browser supports gradient transparency |
|
|
1082 |
var DOCUMENT = Y.config.doc, |
|
|
1083 |
canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
|
1084 |
|
|
|
1085 |
if(DOCUMENT && (DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") || (canvas && canvas.getContext && canvas.getContext("2d")))) |
|
|
1086 |
{ |
|
|
1087 |
var headWoodgrain = mygraphic.addShape({ |
|
|
1088 |
type: "path", |
|
|
1089 |
stroke: { |
|
|
1090 |
weight: 0, |
|
|
1091 |
color: "#f00", |
|
|
1092 |
opacity: 1 |
|
|
1093 |
}, |
|
|
1094 |
fill: { |
|
|
1095 |
type: "linear", |
|
|
1096 |
rotation: 5, |
|
|
1097 |
stops: [ |
|
|
1098 |
{color: "#3B1E09", opacity: 1, offset: 0.03}, |
|
|
1099 |
{color: "#9B4D17", opacity: 1, offset: 0.06}, |
|
|
1100 |
{color: "#3B1E09", opacity: 1, offset: 0.09}, |
|
|
1101 |
{color: "#9B4D17", opacity: 1, offset: 0.12}, |
|
|
1102 |
{color: "#3B1E09", opacity: 1, offset: 0.18}, |
|
|
1103 |
{color: "#9B4D17", opacity: 1, offset: 0.20}, |
|
|
1104 |
{color: "#3B1E09", opacity: 1, offset: 0.23}, |
|
|
1105 |
{color: "#9B4D17", opacity: 1, offset: 0.29}, |
|
|
1106 |
{color: "#3B1E09", opacity: 1, offset: 0.34}, |
|
|
1107 |
{color: "#9B4D17", opacity: 1, offset: 0.36}, |
|
|
1108 |
{color: "#3B1E09", opacity: 1, offset: 0.38}, |
|
|
1109 |
{color: "#9B4D17", opacity: 1, offset: 0.40}, |
|
|
1110 |
{color: "#3B1E09", opacity: 1, offset: 0.45}, |
|
|
1111 |
{color: "#9B4D17", opacity: 1, offset: 0.48}, |
|
|
1112 |
{color: "#3B1E09", opacity: 1, offset: 0.50}, |
|
|
1113 |
{color: "#9B4D17", opacity: 1, offset: 0.52}, |
|
|
1114 |
{color: "#3B1E09", opacity: 1, offset: 0.55}, |
|
|
1115 |
{color: "#9B4D17", opacity: 1, offset: 0.62}, |
|
|
1116 |
{color: "#3B1E09", opacity: 1, offset: 0.68}, |
|
|
1117 |
{color: "#9B4D17", opacity: 1, offset: 0.73}, |
|
|
1118 |
{color: "#3B1E09", opacity: 1, offset: 0.76}, |
|
|
1119 |
{color: "#9B4D17", opacity: 1, offset: 0.78}, |
|
|
1120 |
{color: "#3B1E09", opacity: 1, offset: 0.82}, |
|
|
1121 |
{color: "#9B4D17", opacity: 1, offset: 0.86}, |
|
|
1122 |
{color: "#3B1E09", opacity: 1, offset: 0.90}, |
|
|
1123 |
{color: "#9B4D17", opacity: 1, offset: 0.94}, |
|
|
1124 |
{color: "#3B1E09", opacity: 1, offset: 0.96}, |
|
|
1125 |
{color: "#9B4D17", opacity: 1, offset: 1} |
|
|
1126 |
] |
|
|
1127 |
} |
|
|
1128 |
}); |
|
|
1129 |
|
|
|
1130 |
//Draw the woodgrain |
|
|
1131 |
headWoodgrain.moveTo(614,278); |
|
|
1132 |
headWoodgrain.lineTo(553,263); |
|
|
1133 |
headWoodgrain.curveTo(516,255,503,283,500,300); |
|
|
1134 |
headWoodgrain.lineTo(496,318); |
|
|
1135 |
headWoodgrain.curveTo(496,323,488,323,486,318); |
|
|
1136 |
headWoodgrain.curveTo(405,233,310,332,218,321); |
|
|
1137 |
headWoodgrain.curveTo(149,320,101,270,99,217); |
|
|
1138 |
headWoodgrain.curveTo(96,182,120,143,141,132); |
|
|
1139 |
headWoodgrain.curveTo(162,116,199,116,223,131); |
|
|
1140 |
headWoodgrain.curveTo(242,140,260,170,253,202); |
|
|
1141 |
headWoodgrain.curveTo(249,228,230,242,213,246); |
|
|
1142 |
headWoodgrain.curveTo(214,249,218,257,235,246); |
|
|
1143 |
headWoodgrain.curveTo(254,233,299,209,324,199); |
|
|
1144 |
headWoodgrain.curveTo(369,182,428,185,470,195); |
|
|
1145 |
headWoodgrain.lineTo(505,204); |
|
|
1146 |
headWoodgrain.lineTo(506,203); |
|
|
1147 |
headWoodgrain.lineTo(614,231); |
|
|
1148 |
headWoodgrain.end(); |
|
|
1149 |
|
|
|
1150 |
//handle for adding opacity to the whole object. |
|
|
1151 |
headWoodgrain.addClass('woodgrain'); |
|
|
1152 |
} |
|
|
1153 |
|
|
|
1154 |
//The bushing for the left tuning key |
|
|
1155 |
var nob_bushing_left = mygraphic.addShape({ |
|
|
1156 |
type: "ellipse", |
|
|
1157 |
stroke: { |
|
|
1158 |
weight: 0, |
|
|
1159 |
color: "#00dd00", |
|
|
1160 |
opacity: 1 |
|
|
1161 |
}, |
|
|
1162 |
fill: { |
|
|
1163 |
type: "radial", |
|
|
1164 |
stops: [ |
|
|
1165 |
{color: "#000", opacity: 1, offset: 0}, |
|
|
1166 |
{color: "#000", opacity: 1, offset: 0.7}, |
|
|
1167 |
{color: "#282622", opacity: 1, offset: 0.8}, |
|
|
1168 |
{color: "#000", opacity: 1, offset: 0.9} |
|
|
1169 |
], |
|
|
1170 |
cx: 0.45, |
|
|
1171 |
cy: 0.45, |
|
|
1172 |
fx: 0.9, |
|
|
1173 |
fy: 0.9, |
|
|
1174 |
r: 0.6 |
|
|
1175 |
}, |
|
|
1176 |
width: 52, |
|
|
1177 |
height: 52, |
|
|
1178 |
x: 277, |
|
|
1179 |
y: 240 |
|
|
1180 |
}); |
|
|
1181 |
|
|
|
1182 |
//The bushing for the right tuning key |
|
|
1183 |
var nob_bushing_right = mygraphic.addShape({ |
|
|
1184 |
type: "ellipse", |
|
|
1185 |
stroke: { |
|
|
1186 |
weight: 0, |
|
|
1187 |
color: "#00dd00", |
|
|
1188 |
opacity: 1 |
|
|
1189 |
}, |
|
|
1190 |
fill: { |
|
|
1191 |
type: "radial", |
|
|
1192 |
stops: [ |
|
|
1193 |
{color: "#000", opacity: 1, offset: 0}, |
|
|
1194 |
{color: "#000", opacity: 1, offset: 0.7}, |
|
|
1195 |
{color: "#282622", opacity: 1, offset: 0.8}, |
|
|
1196 |
{color: "#000", opacity: 1, offset: 0.9} |
|
|
1197 |
], |
|
|
1198 |
cx: 0.45, |
|
|
1199 |
cy: 0.45, |
|
|
1200 |
fx: 0.9, |
|
|
1201 |
fy: 0.9, |
|
|
1202 |
r: 0.6 |
|
|
1203 |
}, |
|
|
1204 |
width: 52, |
|
|
1205 |
height: 52, |
|
|
1206 |
x: 429, |
|
|
1207 |
y: 217 |
|
|
1208 |
}); |
|
|
1209 |
|
|
|
1210 |
var leftTuningKeySides = mygraphic.addShape({ |
|
|
1211 |
type: "path", |
|
|
1212 |
stroke: { |
|
|
1213 |
weight: 0, |
|
|
1214 |
color: "#00dd00", |
|
|
1215 |
opacity: 1 |
|
|
1216 |
}, |
|
|
1217 |
fill: { |
|
|
1218 |
type: "radial", |
|
|
1219 |
stops: [ |
|
|
1220 |
{color: "#73371F", opacity: 1, offset: 0}, |
|
|
1221 |
{color: "#35211B", opacity: 1, offset: 1} |
|
|
1222 |
] |
|
|
1223 |
} |
|
|
1224 |
}); |
|
|
1225 |
leftTuningKeySides.moveTo(318,231); |
|
|
1226 |
leftTuningKeySides.curveTo(333,227,344,237,336,252); |
|
|
1227 |
leftTuningKeySides.lineTo(335,253); |
|
|
1228 |
leftTuningKeySides.curveTo(326,267,297,294,286,300); |
|
|
1229 |
leftTuningKeySides.curveTo(281,305,262,295,266,283); |
|
|
1230 |
leftTuningKeySides.curveTo(278,266,306,245,313,234); |
|
|
1231 |
leftTuningKeySides.end(); |
|
|
1232 |
|
|
|
1233 |
var rightTuningKeySides = mygraphic.addShape({ |
|
|
1234 |
type: "path", |
|
|
1235 |
stroke: { |
|
|
1236 |
weight: 0, |
|
|
1237 |
color: "#00dd00", |
|
|
1238 |
opacity: 1 |
|
|
1239 |
}, |
|
|
1240 |
fill: { |
|
|
1241 |
type: "radial", |
|
|
1242 |
stops: [ |
|
|
1243 |
{color: "#73371F", opacity: 1, offset: 0}, |
|
|
1244 |
{color: "#35211B", opacity: 1, offset: 1} |
|
|
1245 |
] |
|
|
1246 |
} |
|
|
1247 |
}); |
|
|
1248 |
|
|
|
1249 |
rightTuningKeySides.moveTo(476,214); |
|
|
1250 |
rightTuningKeySides.curveTo(492,206,504,229,494,238); |
|
|
1251 |
rightTuningKeySides.curveTo(482,247,455,265,432,271); |
|
|
1252 |
rightTuningKeySides.curveTo(422,275,403,262,420,244); |
|
|
1253 |
rightTuningKeySides.curveTo(430,235,463,224,476,214); |
|
|
1254 |
rightTuningKeySides.end(); |
|
|
1255 |
|
|
|
1256 |
//Shared attributes for tuning key edges |
|
|
1257 |
var tuningKeyBevelStyle = { |
|
|
1258 |
type: "path", |
|
|
1259 |
stroke: { |
|
|
1260 |
weight: 0, |
|
|
1261 |
color: "#00dd00", |
|
|
1262 |
opacity: 1 |
|
|
1263 |
}, |
|
|
1264 |
fill: { |
|
|
1265 |
type: "radial", |
|
|
1266 |
stops: [ |
|
|
1267 |
{color: "#DB8C64", opacity: 1, offset: 0}, |
|
|
1268 |
{color: "#593123", opacity: 1, offset: 0.5}, |
|
|
1269 |
{color: "#231610", opacity: 1, offset: 1} |
|
|
1270 |
], |
|
|
1271 |
cx: 0.5, |
|
|
1272 |
cy: 0.5, |
|
|
1273 |
fx: 0.3, |
|
|
1274 |
fy: 0.2, |
|
|
1275 |
r: 0.5 |
|
|
1276 |
} |
|
|
1277 |
}; |
|
|
1278 |
|
|
|
1279 |
//bevel for the right side tuning key |
|
|
1280 |
var leftTuningKeyBevel = mygraphic.addShape(tuningKeyBevelStyle); |
|
|
1281 |
leftTuningKeyBevel.moveTo(318,236); |
|
|
1282 |
leftTuningKeyBevel.curveTo(324,219,345,249,336,249); |
|
|
1283 |
leftTuningKeyBevel.curveTo(316,263,292,286,282,301); |
|
|
1284 |
leftTuningKeyBevel.curveTo(282,304,264,295,266,285); |
|
|
1285 |
leftTuningKeyBevel.curveTo(273,279,313,247,317,237); |
|
|
1286 |
leftTuningKeyBevel.end(); |
|
|
1287 |
|
|
|
1288 |
//bevel for the right side tuning key |
|
|
1289 |
var rightTuningKeyBevel = mygraphic.addShape(tuningKeyBevelStyle); |
|
|
1290 |
rightTuningKeyBevel.moveTo(477,215); |
|
|
1291 |
rightTuningKeyBevel.curveTo(495,205,506,240,494,238); |
|
|
1292 |
rightTuningKeyBevel.curveTo(481,246,443,268,428,272); |
|
|
1293 |
rightTuningKeyBevel.curveTo(421,274,407,256,417,248); |
|
|
1294 |
rightTuningKeyBevel.curveTo(413,253,466,234,477,215); |
|
|
1295 |
rightTuningKeyBevel.end(); |
|
|
1296 |
|
|
|
1297 |
//Add an ellipse for the dowel of the left (opposite side) tuning key |
|
|
1298 |
var nobdowel_left = mygraphic.addShape({ |
|
|
1299 |
type: "ellipse", |
|
|
1300 |
stroke: { |
|
|
1301 |
weight: 0, |
|
|
1302 |
color: "#00dd00", |
|
|
1303 |
opacity: 1 |
|
|
1304 |
}, |
|
|
1305 |
fill: { |
|
|
1306 |
type: "radial", |
|
|
1307 |
stops: [ |
|
|
1308 |
{color: "#8E5B40", opacity: 1, offset: 0}, |
|
|
1309 |
{color: "#593123", opacity: 1, offset: 0.3}, |
|
|
1310 |
{color: "#231610", opacity: 1, offset: 1} |
|
|
1311 |
], |
|
|
1312 |
cx: 0.5, |
|
|
1313 |
cy: 0.5, |
|
|
1314 |
fx: 0.3, |
|
|
1315 |
fy: 0.2, |
|
|
1316 |
r: 0.5 |
|
|
1317 |
}, |
|
|
1318 |
width: 24, |
|
|
1319 |
height: 24, |
|
|
1320 |
x: 228, |
|
|
1321 |
y: 268 |
|
|
1322 |
}); |
|
|
1323 |
|
|
|
1324 |
//Add an ellipse for the dowel of the right (opposite side) tuning key |
|
|
1325 |
var nobdowel_right = mygraphic.addShape({ |
|
|
1326 |
type: "ellipse", |
|
|
1327 |
stroke: { |
|
|
1328 |
weight: 0, |
|
|
1329 |
color: "#00dd00", |
|
|
1330 |
opacity: 1 |
|
|
1331 |
}, |
|
|
1332 |
fill: { |
|
|
1333 |
type: "radial", |
|
|
1334 |
stops: [ |
|
|
1335 |
{color: "#8E5B40", opacity: 1, offset: 0}, |
|
|
1336 |
{color: "#593123", opacity: 1, offset: 0.3}, |
|
|
1337 |
{color: "#231610", opacity: 1, offset: 1} |
|
|
1338 |
], |
|
|
1339 |
cx: 0.5, |
|
|
1340 |
cy: 0.5, |
|
|
1341 |
fx: 0.3, |
|
|
1342 |
fy: 0.2, |
|
|
1343 |
r: 0.5 |
|
|
1344 |
}, |
|
|
1345 |
width: 24, |
|
|
1346 |
height: 24, |
|
|
1347 |
x: 374, |
|
|
1348 |
y: 227 |
|
|
1349 |
}); |
|
|
1350 |
|
|
|
1351 |
//Add an ellipse for the black tip of the left tuning key |
|
|
1352 |
var nob_tip_left = mygraphic.addShape({ |
|
|
1353 |
type: "ellipse", |
|
|
1354 |
stroke: { |
|
|
1355 |
weight: 2, |
|
|
1356 |
color: "#332017", |
|
|
1357 |
opacity: 0.8 |
|
|
1358 |
}, |
|
|
1359 |
fill: { |
|
|
1360 |
type: "radial", |
|
|
1361 |
stops: [ |
|
|
1362 |
{color: "#808080", opacity: 1, offset: 0}, |
|
|
1363 |
{color: "#000", opacity: 1, offset: 0.3}, |
|
|
1364 |
{color: "#000", opacity: 1, offset: 1} |
|
|
1365 |
], |
|
|
1366 |
cx: 0.5, |
|
|
1367 |
cy: 0.5, |
|
|
1368 |
fx: 0.3, |
|
|
1369 |
fy: 0.2, |
|
|
1370 |
r: 0.5 |
|
|
1371 |
}, |
|
|
1372 |
width: 12, |
|
|
1373 |
height: 12, |
|
|
1374 |
x: 297, |
|
|
1375 |
y: 261 |
|
|
1376 |
}); |
|
|
1377 |
|
|
|
1378 |
//Add an ellipse for the black tip of the right tuning key |
|
|
1379 |
var nob_tip_right = mygraphic.addShape({ |
|
|
1380 |
type: "ellipse", |
|
|
1381 |
stroke: { |
|
|
1382 |
weight: 2, |
|
|
1383 |
color: "#332017", |
|
|
1384 |
opacity: 0.8 |
|
|
1385 |
}, |
|
|
1386 |
fill: { |
|
|
1387 |
type: "radial", |
|
|
1388 |
stops: [ |
|
|
1389 |
{color: "#808080", opacity: 1, offset: 0}, |
|
|
1390 |
{color: "#000", opacity: 1, offset: 0.5}, |
|
|
1391 |
{color: "#000", opacity: 1, offset: 1} |
|
|
1392 |
], |
|
|
1393 |
cx: 0.5, |
|
|
1394 |
cy: 0.5, |
|
|
1395 |
fx: 0.3, |
|
|
1396 |
fy: 0.2, |
|
|
1397 |
r: 0.5 |
|
|
1398 |
}, |
|
|
1399 |
width: 12, |
|
|
1400 |
height: 12, |
|
|
1401 |
x: 450, |
|
|
1402 |
y: 238 |
|
|
1403 |
}); |
|
|
1404 |
}); |
|
|
1405 |
</script></pre> |
|
|
1406 |
|
|
|
1407 |
</div> |
|
|
1408 |
</div> |
|
|
1409 |
</div> |
|
|
1410 |
|
|
|
1411 |
<div class="yui3-u-1-4"> |
|
|
1412 |
<div class="sidebar"> |
|
|
1413 |
|
|
|
1414 |
|
|
|
1415 |
|
|
|
1416 |
<div class="sidebox"> |
|
|
1417 |
<div class="hd"> |
|
|
1418 |
<h2 class="no-toc">Examples</h2> |
|
|
1419 |
</div> |
|
|
1420 |
|
|
|
1421 |
<div class="bd"> |
|
|
1422 |
<ul class="examples"> |
|
|
1423 |
|
|
|
1424 |
|
|
|
1425 |
<li data-description="Shows how to create a Graphic instance and add shapes."> |
|
|
1426 |
<a href="graphics-simple.html">Basic Graphics Implementation</a> |
|
|
1427 |
</li> |
|
|
1428 |
|
|
|
1429 |
|
|
|
1430 |
|
|
|
1431 |
<li data-description="Shows how to draw lines and polygons."> |
|
|
1432 |
<a href="graphics-path.html">Basic Path</a> |
|
|
1433 |
</li> |
|
|
1434 |
|
|
|
1435 |
|
|
|
1436 |
|
|
|
1437 |
<li data-description="Shows how to create linear and radial gradient fills."> |
|
|
1438 |
<a href="graphics-gradients.html">Create Gradient Fills</a> |
|
|
1439 |
</li> |
|
|
1440 |
|
|
|
1441 |
|
|
|
1442 |
|
|
|
1443 |
<li data-description="Shows how to add drag to a shape."> |
|
|
1444 |
<a href="graphics-drag.html">Basic drag with graphic object</a> |
|
|
1445 |
</li> |
|
|
1446 |
|
|
|
1447 |
|
|
|
1448 |
|
|
|
1449 |
<li data-description="Shows how to apply transforms to shape."> |
|
|
1450 |
<a href="graphics-transforms.html">Using Transforms</a> |
|
|
1451 |
</li> |
|
|
1452 |
|
|
|
1453 |
|
|
|
1454 |
|
|
|
1455 |
<li data-description="Shows how to use a custom shape with the Graphics module."> |
|
|
1456 |
<a href="graphics-customshape.html">Custom Shape</a> |
|
|
1457 |
</li> |
|
|
1458 |
|
|
|
1459 |
|
|
|
1460 |
|
|
|
1461 |
<li data-description="Shows to use the graphics api to draw a realistic glass."> |
|
|
1462 |
<a href="graphics-muddyglass.html">Transparent Glass with Shadow</a> |
|
|
1463 |
</li> |
|
|
1464 |
|
|
|
1465 |
|
|
|
1466 |
|
|
|
1467 |
<li data-description="Shows to use the graphics api to draw a violin."> |
|
|
1468 |
<a href="graphics-violin.html">Complex Drawing: Violin</a> |
|
|
1469 |
</li> |
|
|
1470 |
|
|
|
1471 |
|
|
|
1472 |
|
|
|
1473 |
|
|
|
1474 |
</ul> |
|
|
1475 |
</div> |
|
|
1476 |
</div> |
|
|
1477 |
|
|
|
1478 |
|
|
|
1479 |
|
|
|
1480 |
<div class="sidebox"> |
|
|
1481 |
<div class="hd"> |
|
|
1482 |
<h2 class="no-toc">Examples That Use This Component</h2> |
|
|
1483 |
</div> |
|
|
1484 |
|
|
|
1485 |
<div class="bd"> |
|
|
1486 |
<ul class="examples"> |
|
|
1487 |
|
|
|
1488 |
|
|
|
1489 |
|
|
|
1490 |
|
|
|
1491 |
|
|
|
1492 |
|
|
|
1493 |
|
|
|
1494 |
|
|
|
1495 |
|
|
|
1496 |
|
|
|
1497 |
|
|
|
1498 |
|
|
|
1499 |
|
|
|
1500 |
|
|
|
1501 |
|
|
|
1502 |
|
|
|
1503 |
|
|
|
1504 |
|
|
|
1505 |
<li data-description="This example demonstrates animating an element along a curved path using bezier control points."> |
|
|
1506 |
<a href="../anim/curve.html">Animating Along a Curved Path</a> |
|
|
1507 |
</li> |
|
|
1508 |
|
|
|
1509 |
|
|
|
1510 |
</ul> |
|
|
1511 |
</div> |
|
|
1512 |
</div> |
|
|
1513 |
|
|
|
1514 |
</div> |
|
|
1515 |
</div> |
|
|
1516 |
</div> |
|
|
1517 |
</div> |
|
|
1518 |
|
|
|
1519 |
<script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
|
1520 |
<script>prettyPrint();</script> |
|
|
1521 |
|
|
|
1522 |
<script> |
|
|
1523 |
YUI.Env.Tests = { |
|
|
1524 |
examples: [], |
|
|
1525 |
project: '../assets', |
|
|
1526 |
assets: '../assets/graphics', |
|
|
1527 |
name: 'graphics-violin', |
|
|
1528 |
title: 'Complex Drawing: Violin', |
|
|
1529 |
newWindow: '', |
|
|
1530 |
auto: false |
|
|
1531 |
}; |
|
|
1532 |
YUI.Env.Tests.examples.push('graphics-simple'); |
|
|
1533 |
YUI.Env.Tests.examples.push('graphics-path'); |
|
|
1534 |
YUI.Env.Tests.examples.push('graphics-gradients'); |
|
|
1535 |
YUI.Env.Tests.examples.push('graphics-drag'); |
|
|
1536 |
YUI.Env.Tests.examples.push('graphics-transforms'); |
|
|
1537 |
YUI.Env.Tests.examples.push('graphics-customshape'); |
|
|
1538 |
YUI.Env.Tests.examples.push('graphics-muddyglass'); |
|
|
1539 |
YUI.Env.Tests.examples.push('graphics-violin'); |
|
|
1540 |
YUI.Env.Tests.examples.push('curve'); |
|
|
1541 |
|
|
|
1542 |
</script> |
|
|
1543 |
<script src="../assets/yui/test-runner.js"></script> |
|
|
1544 |
|
|
|
1545 |
|
|
|
1546 |
|
|
|
1547 |
</body> |
|
|
1548 |
</html> |