Пример #1
0
        public void Construct_Test()
        {
            var svg = svgBuilder.BuildAll();

            //This allows you to do one Read operation.
            Assert.Equal(baseSVGTag + "</svg>\n", svg.IndentedToString(0));
        }
        static void Main(string[] args)
        {
            var filename     = "Test.svg";
            var svgBuilder   = new SVGBuilder(400, 400);
            var svgRectangle = new SVGElement("rect");

            svgRectangle.AddProperty("x", "20")
            .AddProperty("y", "20")
            .AddProperty("width", "250")
            .AddProperty("height", "250")
            .AddProperty("style", "fill:blue");
            var svgAnimation = new SVGElement("animate");

            svgAnimation.AddProperty("attributeType", "CSS")
            .AddProperty("attributeName", "opacity")
            .AddProperty("from", "1")
            .AddProperty("to", "0")
            .AddProperty("dur", "2s")
            .AddProperty("repeatCount", "indefinite");
            svgBuilder.AddElement(svgRectangle.AddElement(svgAnimation));
            var fullSvg = svgBuilder.BuildAll();

            File.WriteAllText(filename, fullSvg.ToString());
        }