# Optimizing this SVG animation for size [closed]

I'd like to code review generated animation, while this might stretch definition of this site, I really hope this is interesting and revelant topic, as this SVG file is really like any other programming language.

I'd like to display certain physical phenomenon, here is example of generated animation (2.5MB of SVG code, after download should start animating after 5 seconds). SVG seemed a good format since I just could dump every hit, whith coordinates in SI units and it just worked.

Every hit is displayed as a dot, like that: (... many more circles..) (... many more circles..)

Fill color and the like is stored in enclosig g tag.

When I animate this I just:

• Add fill-opacity to zero on g tag.
• Add a set element that sets opacity to 1 when this hit should appear.

So each hit looks like that:

 <circle cx="32.6938819885mm" cy="0.733043327928mm" r="0.2mm">
<set attributeName="fill-opacity" attributeType="XML" begin="6.80948s" to="1" />
</circle>


There is some more to this image (like axis) but this is unimportant.

Code that generated this image can be seen in ipython notebook, which can be downloaded from here.

To generate this image I use python and svgwrite, but I really need a hand in pure svg format.

My main question is:

• How can I optimize this svg image so it is smaller and it renders faster, without any significant loss in precision. For not generated image weights 2.5MB which is too much for me.

Other concerns:

• Is there is any other thing you notice in svg I'd be happy to hear it, as this is my first attempt in generating SVG without an application like Inkscape.
• Related question: how can I display label saying: "Current time: 1.2ns" that updates itself with current time in animation. See also my question on this matter on SO.
• How can (easily) start animation (for example) on key-press (it is non obvious, as events do not depend on themselves).

## closed as off-topic by Stephen Rauch, Heslacher, Toby Speight, Ludisposed, hjpotter92Jul 23 '18 at 8:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Lacks concrete context: Code Review requires concrete code from a project, with sufficient context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site." – Stephen Rauch, Heslacher, Ludisposed, hjpotter92
If this question can be reworded to fit the rules in the help center, please edit the question.