title: Freeze svg animation by click
body: <p>I have this svg code that produces 3 rectangles that change colors. I want to freeze them by clicking on any of these 3 rectangles, but I'm new to svg and I have no idea how to do it. I tried by using javascript, but it didn't work. Any ideas?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;svg width="500" height="500" onclick="freezing()"&gt;
    &lt;rect x="10" y="20" width="90" height="60"&gt;
      &lt;animate id="a1" attributeName="fill" from="red" to="blue" dur="3s" fill="freeze"  /&gt;
    &lt;/rect&gt;
    &lt;rect x="10" y="120" width="90" height="60"&gt;
      &lt;animate id="a2" attributeName="fill" from="blue" to="yellow" dur="3s" fill="freeze"  /&gt;
    &lt;/rect&gt;
    &lt;rect x="10" y="220" width="90" height="60"&gt;
      &lt;animate id="a3" attributeName="fill" from="yellow" to="green" dur="3s" fill="freeze" /&gt;
    &lt;/rect&gt;
  &lt;/svg&gt;</code></pre>
  </div>
  </div>
  </p>