SVG: Create-animate
learn SVG Layer - Element creation and animation of its attributes.
Create an HTML container with ID to render the graphical context element
Layer Creation:
To create an SVG layer, invoke the svgLayer method with ContainerID "#mySvg". It returns the SVG renderer instance. For more details on svgLayer please refer : API Reference -> Layers -> SVG Layer Page.
Element Creation:
renderer.createEl() API is used to create the Element of type 'el' with 'attr' attributes and 'style' properties. In the below example we are creating Circle with attributes specified inside the attr object and styles in the style object.
Animation:
Now we will animate circle radius from 50 to 200 and fillStyle from '#ff0000' to '#00ff00' in duration - 500 ms. By specifying loop = 10, animation will be repeated 10 time, with alternate direction and easeInOutSin easing.
Last updated