Loading ...
Sorry, an error occurred while loading the content.

Why won't ECMA added elements repond to beginElement()?

Expand Messages
  • paulroubekas
    In the following example Method 1 does not work, But Method 2 does. switch the comment block tags to try each method. I am using ASV6DR. What is the
    Message 1 of 1 , Mar 4, 2004
    • 0 Attachment
      In the following example Method 1 does not work, But Method 2 does.
      switch the comment block tags to try each method. I am using ASV6DR.
      What is the difference between adding an animate element with ECMA
      script and having a static animate tag from the perspective of the
      beginElement() method? In other words, why won't ECMA added elements
      repond to beginElement()?


      <?xml version="1.0" standalone="no"?>
      <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
      "http://www.w3.org/TR/SVG/DTD/svg10.dtd">
      <svg onload="init(evt)" preserveAspectRatio="xMidYMid meet"
      zoomAndPan="magnify" xmlns="http://www.w3.org/2000/svg"
      xmlns:xlink="http://www.w3.org/1999/xlink">
      <script type="text/ecmascript"><![CDATA[

      /*****
      *
      * init()
      *
      *****/
      function init() {

      var svgRoot = svgDocument.documentElement;

      // Method 1
      // Method 1
      // beginElement() of a dynamically create Element
      staticAnimateToRemove = svgRoot.getElementById("aa");
      staticAnimateToRemoveParent =
      staticAnimateToRemove.parentNode;
      staticAnimateToRemoveParent.removeChild(staticAnimateToRemove)
      wwTextPath = svgRoot.getElementById("tp");
      wwAnimate = wwTextPath.appendChild(svgDocument.createElement
      ("animate"));
      wwAnimate.setAttribute("id", "aa");
      wwAnimate.setAttribute("begin", "indefinite");
      wwAnimate.setAttribute("dur", "100s");
      wwAnimate.setAttribute("attributeName", "startOffset");
      wwAnimate.setAttribute("to", "100%");
      wwAnimate.setAttribute("fill", "freeze");
      wwAnimate.beginElement();
      alert(printNode(wwTextPath));

      /*
      // Method 2
      // Method 2
      // beginElement of a dynamically create Element
      anim = svgRoot.getElementById("aa");
      anim.beginElement();
      alert(printNode(anim.parentNode));
      */

      }
      ]]></script>

      <defs>
      <filter id="fltrChrome" filterUnits="objectBoundingBox" x="-10%" y="-
      10%" width="120%" height="120%" filterRes="0">
      <feMorphology operator="erode" in="SourceAlpha" radius="6"
      result="erodeAlpha6"/>
      <feGaussianBlur in="erodeAlpha6" stdDeviation="2.6,3.4"
      result="outerBlur"/>
      <feGaussianBlur in="SourceGraphic" stdDeviation="2.6,3.4"
      result="innerBlur"/>
      <feComposite in="outerBlur" in2="innerBlur" operator="in"
      opacity="1" result="compBlur"/>
      <feDiffuseLighting in="compBlur" surfaceScale="-10"
      diffuseConstant="2" lighting-color="rgb(255,255,255)"
      result="lighting">
      <feDistantLight azimuth="65" elevation="5"/>
      </feDiffuseLighting>

      <feGaussianBlur in="lighting" stdDeviation="4,4"
      result="litBlur"/>
      <feComposite in="litBlur" in2="SourceAlpha" operator="in"
      result="texture"/>
      <feComponentTransfer in="texture">
      <feFuncR type="table" tableValues="1.2,-0.3,0.5,1.2,-
      0.3,1.3"/>
      <feFuncG type="table" tableValues="1.2,-0.3,0.5,1.2,-
      0.3,1.3"/>
      <feFuncB type="table" tableValues="1.2,-0.3,0.5,1.5,-
      0.3,1.3"/>
      </feComponentTransfer>
      </filter>
      </defs>
      <g id="progressScreen">
      <rect width="100%" height="100%" fill="black"/>

      <g id="progressBar_SE1_DrawingTemplate">
      <text startOffset="0"
      id="loadingStatus_SE1_DrawingTemplate" fill="gray" stroke="gray">
      <textPath id="tp"
      xlink:href="#textPathCurve_SE1_DrawingTemplate">
      <path
      id="textPathCurve_SE1_DrawingTemplate" fill="none" d="M10 400 l0 0
      123.392578125 0 q100 -100 100 10 T194.94140625 155 l -80 -10"/>
      <tspan>SE1_DrawingTemplate</tspan>
      <animate id="aa" accumulate="none"
      additive="replace" calcMode="linear" fill="freeze" restart="always"
      begin="indefinite" dur="100s" attributeName="startOffset" to="100%"/>
      </textPath>
      </text>

      </g><text startOffset="0" id="loadingFilesText" filter="url
      (#fltrChrome)" text-anchor="middle" fill="whitesmoke"
      stroke="whitesmoke" stroke-width="10" font-family="Courier New" font-
      size="200" opacity="0.75">
      <tspan x="555" y="155">Loading</tspan>
      <tspan x="555" dy="1em">Files</tspan>
      </text>

      </g>
      </svg>
    Your message has been successfully submitted and would be delivered to recipients shortly.