Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / as-background-image / resources / linguistics.svg
blobe1002be55e94b6d313d8e781906f54bce3ff0680
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
3 "http://www.w3.org/TR/SVG/DTD/svg10.dtd" >
4 <svg width='100%' height='100%'
5 xmlns='http://www.w3.org/2000/svg'
6 xmlns:xlink='http://www.w3.org/1999/xlink'
7 onload='Init(evt)'>
8 <title>Phonetics Guide</title>
10 <desc>
11 An animated multimedia guide to the formation of
12 sounds in natural human languages, version 1.5.
13 Based on data from Clark and Yallop (2nd ed.).
15 This application was created by Douglas Alan Schepers
16 (doug@schepers.cc) for use in SVG-based linguistics
17 applications. For non-commerical purposes, you may
18 use or distribute this application free of charge,
19 provided you include this notice; for commercial
20 usage, please obtain a license.
22 All code copyright (c) D.A. Schepers, 2002-3.
23 </desc>
25 <script language='JavaScript'><![CDATA[
27 var SVGDocument = null;
28 var SVGRoot = null;
29 var Tongue = null;
30 var Palette = null;
31 var Jaw = null;
32 var VocalFolds = null;
33 var Cartilage = null;
34 //var Sound = null;
36 function Init(evt)
38 SVGDocument = evt.target.ownerDocument;
39 SVGRoot = SVGDocument.documentElement;
41 Tongue = SVGDocument.getElementById('tongue');
42 Palette = SVGDocument.getElementById('palette');
43 Jaw = SVGDocument.getElementById('jaw');
44 VocalFolds = SVGDocument.getElementById('vocalFolds');
45 Cartilage = SVGDocument.getElementById('CuneiformCorniculateCartilage');
47 //Sound = SVGDocument.getElementById('sound');
48 //PlaySound();
52 next, I'm gonna animate the vocal chords and (top-down) and lips (front on) as well, and show air flow and air pressure gradients, all synced with the sound. if I can, anyway...
54 function PlaySound()
56 Sound.beginElement();
57 setTimeout('PlaySound()', 5000);
62 function ShowPosition(evt, isShow)
64 try
66 var button = evt.target;
67 var buttonId = button.getAttribute('id');
68 var place = buttonId.split('-')[0];
70 var labelText = place;
71 var labelColor = 'gold';
72 if (!isShow)
74 labelColor = 'white';
75 place = 'rest';
78 var label = SVGDocument.getElementById(labelText + '-Label');
79 label.setAttributeNS(null, 'fill', labelColor);
81 if ('voiced' == place || 'voiceless' == place)
83 var vocalFoldsPosition = place;
84 if (!vocalFoldsArray[place])
86 vocalFoldsPosition = 'voiceless';
87 cartilagePosition = 'voiceless';
89 var vocalFoldsDesc = vocalFoldsArray[vocalFoldsPosition];
90 newVocalFolds = vocalFoldsDesc;
92 var cartilagePosition = place;
93 if (!cartilageArray[place])
95 cartilagePosition = 'voiceless';
97 var cartilageDesc = cartilageArray[cartilagePosition];
98 newCartilage = cartilageDesc;
100 AnimateVocalFolds();
101 AnimateCartilage();
103 else
106 var jawPosition = place;
107 if (!jawArray[place])
109 jawPosition = 'rest';
111 var jawDesc = jawArray[jawPosition];
113 var palettePosition = place;
114 if (!paletteArray[place])
116 palettePosition = 'pharyngeal';
118 var paletteDesc = paletteArray[palettePosition];
120 var tonguePosition = place;
121 if (!tongueArray[place])
123 tonguePosition = 'rest';
125 var tongueDesc = tongueArray[tonguePosition];
127 newTongue = tongueDesc;
128 AnimateTongue();
130 newJaw = jawDesc;
131 AnimateJaw();
132 newPalette = paletteDesc;
133 AnimatePalette();
137 catch(er)
139 alert('Error in function ShowPosition:\n' + er.message)
144 function AnimateMouth(mouthPart, currentPos, newPos)
148 var currentPos = mouthPart.getAttributeNS(null, 'd');
149 newPos = newPos.replace(/,/g, ' ');
150 currentPos = currentPos.replace(/,/g, ' ');
152 if (newPos != currentPos)
154 var changed = false;
157 var currentArray = currentPos.split(/\W+/);
158 var newArray = newPos.split(/\W+/);
159 for (var n = 0; currentArray.length > n; n++)
161 if (currentArray[n])
163 header = currentArray[n].match(/\D/);
164 eachCurrentNum = Number(currentArray[n].match(/\d+/));
165 eachNewNum = Number(newArray[n].match(/\d+/));
167 if (eachNewNum > eachCurrentNum)
169 eachCurrentNum++;
170 changed = true;
171 //alert(eachNewNum +' : ' + eachCurrentNum)
173 else if (eachNewNum < eachCurrentNum)
175 eachCurrentNum--;
176 changed = true;
178 currentArray[n] = header + eachCurrentNum;
182 var currentPos = currentArray.join(' ');
183 mouthPart.setAttributeNS(null, 'd', currentPos);
185 if (changed)
187 //alert(0)
188 //window.status = newPos +' :: ' + currentPos;
189 window.setTimeout(AnimateMouth(mouthPart, currentPos, newPos), 1000000);
193 catch(er)
195 alert('Error in function AnimateMouth:\n' + er.message)
200 var newTongue = null;
201 function AnimateTongue()
205 var currentTongue = Tongue.getAttributeNS(null, 'd');
206 newTongue = newTongue.replace(/,/g, ' ');
207 currentTongue = currentTongue.replace(/,/g, ' ');
209 if (newTongue != currentTongue)
211 var changed = false;
213 var descArray = currentTongue.split(/\W+/);
214 var newArray = newTongue.split(/\W+/);
215 for (var n = 0; descArray.length > n; n++)
217 if (descArray[n])
219 header = descArray[n].match(/\D/);
220 eachDescNum = Number(descArray[n].match(/\d+/));
221 eachNewNum = Number(newArray[n].match(/\d+/));
223 if (eachNewNum > eachDescNum)
225 eachDescNum++;
226 changed = true;
228 else if (eachNewNum < eachDescNum)
230 eachDescNum--;
231 changed = true;
233 descArray[n] = header + eachDescNum;
237 var tempDesc = descArray.join(' ');
238 Tongue.setAttributeNS(null, 'd', tempDesc);
240 if (changed)
242 window.setTimeout('AnimateTongue()', 1);
246 catch(er)
248 alert('Error in function AnimateTongue:\n' + er.message)
254 var newJaw = null;
255 function AnimateJaw()
259 var currentJaw = Jaw.getAttributeNS(null, 'd');
260 newJaw = newJaw.replace(/,/g, ' ');
261 currentJaw = currentJaw.replace(/,/g, ' ');
263 if (newJaw != currentJaw)
265 var changed = false;
267 var descArray = currentJaw.split(/\W+/);
268 var newArray = newJaw.split(/\W+/);
269 for (var n = 0; descArray.length > n; n++)
271 if (descArray[n])
273 header = descArray[n].match(/\D/);
274 eachDescNum = Number(descArray[n].match(/\d+/));
275 eachNewNum = Number(newArray[n].match(/\d+/));
277 if (eachNewNum > eachDescNum)
279 eachDescNum++;
280 changed = true;
282 else if (eachNewNum < eachDescNum)
284 eachDescNum--;
285 changed = true;
287 descArray[n] = header + eachDescNum;
291 var tempDesc = descArray.join(' ');
292 Jaw.setAttributeNS(null, 'd', tempDesc);
294 if (changed)
296 window.setTimeout('AnimateJaw()', 1);
300 catch(er)
302 alert('Error in function AnimateJaw:\n' + er.message)
307 var newPalette = null;
308 function AnimatePalette()
312 var currentPalette = Palette.getAttributeNS(null, 'd');
313 newPalette = newPalette.replace(/,/g, ' ');
314 currentPalette = currentPalette.replace(/,/g, ' ');
316 if (newPalette != currentPalette)
318 var changed = false;
320 var descArray = currentPalette.split(/\W+/);
321 var newArray = newPalette.split(/\W+/);
322 for (var n = 0; descArray.length > n; n++)
324 if (descArray[n])
326 header = descArray[n].match(/\D/);
327 eachDescNum = Number(descArray[n].match(/\d+/));
328 eachNewNum = Number(newArray[n].match(/\d+/));
330 if (eachNewNum > eachDescNum)
332 eachDescNum++;
333 changed = true;
335 else if (eachNewNum < eachDescNum)
337 eachDescNum--;
338 changed = true;
340 descArray[n] = header + eachDescNum;
344 var tempDesc = descArray.join(' ');
345 Palette.setAttributeNS(null, 'd', tempDesc);
347 if (changed)
349 window.setTimeout('AnimatePalette()', 0);
353 catch(er)
355 alert('Error in function AnimatePalette:\n' + er.message)
360 var newVocalFolds = null;
361 function AnimateVocalFolds()
365 var currentVocalFolds = VocalFolds.getAttributeNS(null, 'd');
366 newVocalFolds = newVocalFolds.replace(/,/g, ' ');
367 currentVocalFolds = currentVocalFolds.replace(/,/g, ' ');
369 if (newVocalFolds != currentVocalFolds)
371 var changed = false;
373 var descArray = currentVocalFolds.split(/\W+/);
374 var newArray = newVocalFolds.split(/\W+/);
375 for (var n = 0; descArray.length > n; n++)
377 if (descArray[n])
379 header = descArray[n].match(/\D/);
380 eachDescNum = Number(descArray[n].match(/\d+/));
381 eachNewNum = Number(newArray[n].match(/\d+/));
383 if (eachNewNum > eachDescNum)
385 eachDescNum++;
386 changed = true;
388 else if (eachNewNum < eachDescNum)
390 eachDescNum--;
391 changed = true;
393 descArray[n] = header + eachDescNum;
397 var tempDesc = descArray.join(' ');
398 VocalFolds.setAttributeNS(null, 'd', tempDesc);
400 if (changed)
402 window.setTimeout('AnimateVocalFolds()', 0);
406 catch(er)
408 alert('Error in function AnimateVocalFolds:\n' + er.message)
413 var newCartilage = null;
414 function AnimateCartilage()
418 var currentCartilage = Cartilage.getAttributeNS(null, 'd');
419 newCartilage = newCartilage.replace(/,/g, ' ');
420 currentCartilage = currentCartilage.replace(/,/g, ' ');
422 if (newCartilage != currentCartilage)
424 var changed = false;
426 var descArray = currentCartilage.split(/\W+/);
427 var newArray = newCartilage.split(/\W+/);
428 for (var n = 0; descArray.length > n; n++)
430 if (descArray[n])
432 //alert(descArray[n])
433 header = descArray[n].match(/\D/);
434 eachDescNum = Number(descArray[n].match(/\d+/));
435 eachNewNum = Number(newArray[n].match(/\d+/));
437 if ('Z' == header)
439 eachDescNum = '';
441 else if (eachNewNum > eachDescNum)
443 eachDescNum++;
444 changed = true;
446 else if (eachNewNum < eachDescNum)
448 eachDescNum--;
449 changed = true;
451 descArray[n] = header + eachDescNum;
455 var tempDesc = descArray.join(' ');
456 Cartilage.setAttributeNS(null, 'd', tempDesc);
458 if (changed)
460 window.setTimeout('AnimateCartilage()', 0);
464 catch(er)
466 alert('Error in function AnimateCartilage:\n' + er.message)
472 var tongueArray = new Array();
473 tongueArray['rest'] = 'M159,283 C179,254 128,235 91,243 S59,264 86,280 ';
474 tongueArray['dental'] = 'M159,283 C173,248 129,246 85,241 S58,259 86,280';
475 tongueArray['interdental'] = 'M159,283 C174,244 130,236 79,250 S67,259 86,280';
476 tongueArray['alveolar'] = 'M159,283 C174,244 131,254 87,242 S68,254 86,280';
477 tongueArray['alveopalatal'] = 'M159,283 C145,247 91,206 74,246 S103,224 86,280';
478 tongueArray['palatal'] = 'M159,283 C177,213 113,214 87,248 S107,247 86,280';
479 tongueArray['velar'] = 'M159,283 C158,162 126,236 88,249 S93,261 86,280';
480 tongueArray['uvular'] = 'M159,283 C183,177 147,230 94,249 S93,261 86,280';
481 tongueArray['pharyngeal'] = 'M159,283 C204,257 196,219 120,246 S109,261 86,280';
483 var jawArray = new Array();
484 jawArray['rest'] = 'M175,418 C152,370 155,346 177,305 S172,299 163,298 C183,273 161,277 159,282 Q117,264 86,280 Q69,283 64,270 T61,283 C49,279 54,259 38,267 S44,285 39,301 C27,352 55,341 101,340 S131,364 136,375 Q143,399 140,420';
485 jawArray['bilabial'] = 'M175,418 C152,370 155,346 177,305 S172,299 163,298 C183,273 161,277 159,282 Q117,264 86,280 Q69,278 64,262 T60,274 C47,273 53,251 37,256 S41,268 37,291 C26,342 55,332 101,340 S131,364 136,375 Q143,399 140,420';
486 jawArray['labiodental'] = 'M175,418 C152,370 155,346 177,305 S172,299 163,298 C183,273 161,277 159,282 Q117,264 86,280 Q69,278 64,262 T60,274 C47,273 70,262 49,254 S47,267 37,291 C26,342 55,332 101,340 S131,364 136,375 Q143,399 140,420';
487 jawArray['pharyngeal'] = 'M175,418 C152,370 155,346 177,305 S172,299 163,298 C183,273 161,277 159,282 Q117,264 88,278 Q70,298 63,280 T60,290 C48,288 54,268 38,276 S44,294 39,310 C27,361 55,350 99,349 S131,364 136,375 Q143,399 140,420';
489 var paletteArray = new Array();
490 paletteArray['rest'] = 'M30,221 C119,224 140,201 166,207 C177,223 173,245 163,228 S144,220 90,228 Q76,238 63,240 C55,243 58,261 55,256 S51,247 48,236 C44,243 48,258 34,254 S37,238 29,221';
491 paletteArray['glottal'] = 'M30,221 C119,224 140,201 166,207 C177,223 173,245 163,228 S144,220 90,228 Q76,238 63,240 C55,243 58,261 55,256 S51,247 48,236 C44,243 48,258 34,254 S37,238 29,221';
492 paletteArray['bilabial'] = 'M30,221 C118,220 140,199 175,211 C182,232 182,254 170,230 S126,225 90,228 Q76,238 63,240 C55,243 58,261 55,256 S51,247 48,236 C43,241 48,258 34,255 S36,241 29,221';
493 paletteArray['labiodental'] = 'M30,221 C118,220 138,193 170,203 C179,221 178,245 165,222 S126,225 90,228 Q76,238 63,240 C55,243 58,261 55,256 S51,247 48,236 C43,229 48,258 33,250 S37,238 29,221';
494 paletteArray['pharyngeal'] = 'M30,221 C118,220 138,193 170,203 C179,221 178,245 165,222 S126,225 90,228 Q76,238 63,240 C55,243 58,261 55,256 S51,247 48,236 C44,243 48,258 34,254 S37,238 29,221';
496 var vocalFoldsArray = new Array();
497 vocalFoldsArray['voiceless'] = 'M270,309 Q281,334 284,364 L295,360 Q291,324 275,301 H265 Q249,324 245,360 L256,364 Q259,334 270,309';
498 vocalFoldsArray['voiced'] = 'M270,309 Q271,334 271,371 L283,364 Q285,324 275,301 H265 Q254,324 257,364 L269,371 Q269,334 270,309';
500 var cartilageArray = new Array();
501 cartilageArray['voiceless'] = 'M225,322 L230,339 Q243,347 250,359 262,364 270,371 279,364 290,359 298,347 310,339 L314,322 320,326 315,339 Q310,354 298,364 288,378 270,374 252,378 242,364 230,354 225,339 L219,326 Z';
502 cartilageArray['voiced'] = 'M225,322 L230,339 Q246,351 250,359 263,359 270,371 278,359 290,359 295,351 310,339 L314,322 320,326 315,339 Q309,360 298,364 288,379 270,374 252,379 242,364 231,360 225,339 L219,326 Z';
504 ]]></script>
507 <g stroke='brown' stroke-width='2' fill='pink'>
509 <path id='head'
510 d='M226,411 C190,338 201,286 182,231 C164,174 173,213 132,178 C125,172 126,153 94,160 S68,143 17,206 Q14,212 16,219 C-10,212 17,188 40,166 S36,132 46,105 C63,23 205,-9 264,13 S419,95 340,212 Q313,254 346,367 '
513 <path id='palette'
514 d='M30,221 C119,224 140,201 166,207 C177,223 173,245 163,228 S144,220 90,228 Q76,238 63,240 C55,243 58,261 55,256 S51,247 48,236 C44,243 48,258 34,254 S37,238 29,221 '
517 <path id='jaw'
518 d='M175,418 C152,370 155,346 177,305 S172,299 163,298 C183,273 161,277 159,282 Q117,264 86,280 Q69,283 64,270 T61,283 C49,279 54,259 38,267 S44,285 39,301 C27,352 55,341 101,340 S131,364 136,375 Q143,399 140,420 '
521 <path id='esophagus'
522 d='M207,416 C205,404 198,368 193,353 C184,348 159,355 160,350 C172,344 187,346 188,345 C190,343 187,331 194,334 C197,334 208,394 212,415'
525 <!--
526 <path id='esophagus'
527 d='M207,416 C205,404 198,368 193,353 C184,348 182,353 179,350 C172,344 187,346 188,345 C190,343 187,331 194,334 C197,334 208,394 212,415'
529 <path id='vocalChords'
530 d='M184,350 L160,356 M160,352 L179,345'
531 fill-rule='evenodd'
536 <path id='tongue'
537 d='M159,283 C179,254 128,235 91,243 S59,264 86,280 '
539 </g>
542 <!--
543 <text id='TongueText' x='-126' y='-91'>
544 <textPath id='tonguePath' xlink:href='#tongue' startOffset='50%'>text on path
545 </textPath>
546 </text>
547 <animate id='firsttpath' attributeName='startOffset' values='0%;77.5%' keyTimes='0;1' dur='20s' repeatCount='indefinite' fill='freeze'/>
551 <circle cx='175' cy='350' r='22' stroke='gray' fill='white' opacity='0.5'/>
552 <circle cx='270' cy='330' r='50' stroke='gray' fill='white' opacity='0.7'/>
553 <line x1='166' y1='330' x2='248' y2='285' stroke='gray' fill='none' opacity='0.5' stroke-linecap='round'/>
554 <line x1='175' y1='372' x2='267' y2='380' stroke='gray' fill='none' opacity='0.5' stroke-linecap='round'/>
556 <defs>
557 <radialGradient id='fade'>
558 <stop offset='90%' stop-color='white' stop-opacity='1.0'/>
559 <stop offset='95%' stop-color='white' stop-opacity='0.5'/>
560 <stop offset='100%' stop-color='white' stop-opacity='0.0'/>
561 </radialGradient>
562 <mask id='fademask'>
563 <circle cx='270' cy='330' r='50' fill='url(#fade)'/>
564 </mask>
565 </defs>
567 <g id='phraynx' mask='url(#fademask)'>
568 <ellipse id='vocalBack' cx='270' cy='330' rx='44' ry='40' fill='pink'/>
569 <path id='gap'
570 d='M270,309 Q285,334 284,361
571 Q279,364 270,371 262,364 256,361
572 Q256,334 270,309'
573 fill='#87cefa' fill-opacity='0.5'
575 <g fill='pink' fill-rule='evenodd' stroke='brown' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'>
576 <path id='vocalFolds'
577 d='M270,309 Q281,334 284,364
578 L295,360 Q291,324 275,301
579 H265 Q249,324 245,360
580 L256,364 Q259,334 270,309'
581 fill='white' stroke='#ff6347'
584 <path id='CuneiformCorniculateCartilage'
585 d='M225,322 L230,339
586 Q243,347 250,359 262,364 270,371 279,364 290,359 298,347 310,339
587 L314,322 320,326 315,339
588 Q310,354 298,364 288,378 270,374 252,378 242,364 230,354 225,339
589 L219,326 Z'
590 fill='#eee8aa' stroke='#daa520'
592 <path id='oddThing'
593 d='M250,299 Q270,319 290,299'
595 <path id="epiglottis"
596 d='M215,327 C238,324 243,302 270,300 297,302 302,324 325,327 V324
597 C301,321 310,278 270,289 230,278 241,321 215,324 Z'
599 </g>
600 </g>
603 <g stroke='blue' fill='cornflowerblue'
604 onmouseover='ShowPosition(evt, true)'
605 onmouseout='ShowPosition(evt, false)'>
606 <rect id='bilabial-Button' x='400' y='10' width='100' height='20' rx='5' ry='5'/>
607 <rect id='labiodental-Button' x='400' y='40' width='100' height='20' rx='5' ry='5'/>
608 <rect id='dental-Button' x='400' y='70' width='100' height='20' rx='5' ry='5'/>
609 <rect id='interdental-Button' x='400' y='100' width='100' height='20' rx='5' ry='5'/>
610 <rect id='alveolar-Button' x='400' y='130' width='100' height='20' rx='5' ry='5'/>
611 <rect id='alveopalatal-Button' x='400' y='160' width='100' height='20' rx='5' ry='5'/>
612 <rect id='palatal-Button' x='400' y='190' width='100' height='20' rx='5' ry='5'/>
613 <rect id='velar-Button' x='400' y='220' width='100' height='20' rx='5' ry='5'/>
614 <rect id='uvular-Button' x='400' y='250' width='100' height='20' rx='5' ry='5'/>
615 <rect id='pharyngeal-Button' x='400' y='280' width='100' height='20' rx='5' ry='5'/>
616 <rect id='glottal-Button' x='400' y='310' width='100' height='20' rx='5' ry='5'/>
618 <rect id='voiced-Button' x='400' y='370' width='100' height='20' rx='5' ry='5'/>
619 <rect id='voiceless-Button' x='400' y='400' width='100' height='20' rx='5' ry='5'/>
620 </g>
622 <g fill='white' pointer-events='none' text-anchor='middle' font-size='14px'>
623 <text id='bilabial-Label' x='450' y='25'>Bilabial</text>
624 <text id='labiodental-Label' x='450' y='55'>Labiodental</text>
625 <text id='dental-Label' x='450' y='85'>Dental</text>
626 <text id='interdental-Label' x='450' y='115'>Interdental</text>
627 <text id='alveolar-Label' x='450' y='145'>Alveolar</text>
628 <text id='alveopalatal-Label' x='450' y='175'>Alveopalatal</text>
629 <text id='palatal-Label' x='450' y='205'>Palatal</text>
630 <text id='velar-Label' x='450' y='235'>Velar</text>
631 <text id='uvular-Label' x='450' y='265'>Uvular</text>
632 <text id='pharyngeal-Label' x='450' y='295'>Pharyngeal</text>
633 <text id='glottal-Label' x='450' y='325'>Glottal</text>
635 <text id='voiced-Label' x='450' y='385'>Voiced</text>
636 <text id='voiceless-Label' x='450' y='415'>Voiceless</text>
637 </g>
641 <!--
642 <asv='audio id='sound' xlink='href='bilabialClick.mp3' begin='indefinite' />
646 </svg>