1.5 KiB
Animation
Native SVG animation elements are discovered/countable in source but removed from every rendered editing projection, so imported SMIL and event-triggered animation cannot execute automatically. Imported scripts are never supported.
Version 0.1.0 implements a deliberately small app-owned animation slice:
- add an opacity animation to the selected element;
- enable/disable/remove definitions;
- preview generated CSS only in the opaque-origin canvas;
- persist definitions in an explicit
.svgtools.jsonproject; - apply validated CSS plus stable target IDs to source in one transaction.
One shared validator is used for project import, preview and Apply. It bounds definition/keyframe counts and strings, requires finite ordered offsets and bounded timing/iteration values, allowlists property/kind/direction/fill mode, accepts only safe easing grammar and parses every CSS value with css-tree. URLs, resource functions, structural CSS/XML characters and parser raw nodes are rejected even for disabled definitions. Selectors and keyframe identifiers are escaped/generated by the app.
The preview has play/pause as an enable toggle but no timeline, seek or native SMIL editing. Duration/keyframes are not yet exposed as a general UI. Transform, colour, motion-path and compatible path-morph authoring, animation discovery panels and conversion between CSS/SMIL remain future milestones. Applying CSS changes the SVG source intentionally and may affect downstream consumers that do not support the same CSS animation features.