home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 January / PCWorld_2005-01_cd.bin / novinky / Interval / podklady / hejral / 1033 / a16-3-physics.svg < prev    next >
Extensible Markup Language  |  2004-11-21  |  5KB  |  100 lines

  1. ∩╗┐<?xml version="1.0" encoding="utf-8"?>
  2. <!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG Version: 3.0.0 Build 76)  -->
  3. <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
  4.     <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
  5.     <!ENTITY ns_svg "http://www.w3.org/2000/svg">
  6.     <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
  7. ]>
  8. <svg xmlns="&ns_svg;" 
  9.      xmlns:xlink="&ns_xlink;" 
  10.      xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
  11.      width="320" height="200" 
  12.      shape-rendering="optimizeSpeed"
  13.      onload="testAdobe();fade()">
  14.     <title>A16.3 - Fyzika - f├íze 3</title>
  15.     <desc>
  16.       Realistick├⌐ ┼Ö├¡zen├¡ rychlosti a zrychlen├¡ pomoc├¡ JavaScriptu v─ì. postupn├⌐ho zmen┼íov├ín├¡ amplitudy kmit┼».
  17.     </desc>
  18.     <script type="text/ecmascript">
  19.     <![CDATA[
  20.     function testAdobe() {
  21.         //created by Martin Hejral, 2003
  22.         //test if Adobe SVG Viewer 3 (ASV3) or greater is present -- only ASV3+ return "Adobe SVG Viewer"
  23.         //alert(navigator.appName+navigator.appVersion);
  24.         if(window.navigator)
  25.             if( (navigator.appName=="Adobe SVG Viewer") && (navigator.appVersion>="3.0") )
  26.                 return true;
  27.         alert("PROSIM, nainstalujte novou verzi Adobe SVG Prohlizece!!! PLEASE, install latest version of the Adobe SVG Viewer!!!");
  28.         return false;
  29.     }
  30.     //global variables
  31.     var amp=50, scale=0.34, time=0, to=-1;
  32.     //perform fading animation
  33.     function fade() {
  34.         //get pointer to animated objects
  35.         var obj1 = document.getElementById('sphere1');
  36.         var obj2 = document.getElementById('spring1');
  37.         var s = y = Math.cos(time/1000);
  38.         //window.status="time = "+time/1000+" s";
  39.         //multiply COS t with amplitude
  40.         y *= amp;
  41.         //shift sphere to base position
  42.         y -= 50;
  43.         //scale spring
  44.         s *= scale;
  45.         //set base position
  46.         s += 0.34 + 0.32;
  47.         time += 50;
  48.         //amplitude and scale decay
  49.         amp = amp*999/1000;
  50.         scale = scale*999/1000;
  51.         //modify SVG graphics
  52.         obj1.setAttribute( "transform", "translate(0,"+y+")" );
  53.         obj2.setAttribute( "transform", "scale(1,"+s+")" );
  54.         //start timer
  55.         to = window.setTimeout("fade()", 50);
  56.     }
  57.     ]]>
  58.     </script>
  59.     <defs>
  60.     <symbol id="spring">
  61.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M16.3,3v9.9l9.1,2.4L7.1,20.2"/>
  62.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,20.2l18.3,4.9L7.1,30"/>
  63.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,30l18.3,4.9L7.1,39.8"/>
  64.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,39.8l18.3,4.9L7.1,49.5"/>
  65.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,49.5l18.3,4.9L7.1,59.3"/>
  66.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,59.3l18.3,4.9L7.1,69.1"/>
  67.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,69.1L25.4,74L7.1,78.9"/>
  68.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,78.9l18.3,4.9L7.1,88.7"/>
  69.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,88.7l18.3,4.9L7.1,98.5"/>
  70.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,98.5l18.3,4.9l-18.3,4.9"/>
  71.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,108.3l18.3,4.9L7.1,118"/>
  72.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,118l18.3,4.9l-18.3,4.9"/>
  73.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,127.8l18.3,4.9l-18.3,4.9"/>
  74.         <path fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" d="M7.1,137.6l18.3,4.9l-9.1,2.4v16"/>
  75.     </symbol>
  76.     <symbol id="sphere">
  77.         <radialGradient id="XMLID_1_" cx="10.75" cy="162.811" r="23.0054" fx="10.75" fy="162.811" gradientUnits="userSpaceOnUse">
  78.             <stop  offset="0" style="stop-color:#FFFFFF"/>
  79.             <stop  offset="1" style="stop-color:#000000"/>
  80.             <a:midPointStop  offset="0" style="stop-color:#FFFFFF"/>
  81.             <a:midPointStop  offset="0.5" style="stop-color:#FFFFFF"/>
  82.             <a:midPointStop  offset="1" style="stop-color:#000000"/>
  83.         </radialGradient>
  84.         <path fill="url(#XMLID_1_)" d="M32.5,168.6c0,9-7.3,16.3-16.3,16.3S0,177.5,0,168.6s7.3-16.3,16.3-16.3S32.5,159.6,32.5,168.6z"/>
  85.     </symbol>
  86.     <symbol id="fix_point">
  87.         <path fill="none" stroke="#000000" stroke-width="6" d="M8.3,3h16"/>
  88.     </symbol>
  89.     </defs>
  90.   <!-- symboly vlozime do obrazu -->
  91.     <use id="spring1" x="50" xlink:href="#spring">
  92.     </use>
  93.     <use id="sphere1" x="50" xlink:href="#sphere">
  94.     </use>
  95.     <use x="50" xlink:href="#fix_point">
  96.     </use>
  97.     <!-- obrys platna -->
  98.     <rect x="0" y="0" width="319" height="199" 
  99.         fill="none" stroke="blue" />
  100. </svg>