Construct a SVGNode respresenting the tagName element with no attributes, children or inner text.
created node tagName
Fetch the current attributes
Fetch the current children
Fetch the events defined on the node
Fetch the innerText of the node
Fetch the tagName of the node
Fetch the tags set on the node
Animates the node using an SVGAnimate object
Mutates the SVGNode to append an child SVGNode child to the children of the current SVGNode. Then, it returns itself, for easy programming.
Adds a class to a SVGNode
Remove either all events from 1 SVGEventName, or all if not given a name
Creates a deepcopy from current SVGNode
Setter for the cx attribute
Setter for the cy attribute
Checks deeply whether two nodes are equal
Shortcut for setting fill attributes
Shortcut for setting fill attributes to a definition (See more at SVGManager.define)
Fetch a specific attribute's value
Mutates the SVGNode to change an attribute attr by putting its value through the function f. Then, it returns itself, for easy programming.
If the attribute was not set, the call still succeeds but does nothing.
Mutates the SVGNode to add an event. Multiple functions can be set for the same event. Then, it returns itself, for easy programming.
Setter for the r attribute
Remove child at certain index
Remove all children
Mutates the SVGNode to add/change an attribute attr to value. Then, it returns itself, for easy programming.
Checks shallowly whether two nodes are equal
Shortcut for setting stroke attributes
Shortcut for setting stroke attributes to a definition (See more at SVGManager.define)
Give tag to the SVGNode to mention later
Tag given to SVGNode
Sets the innerText of the node
Returns the JS SVGElement equavalent of current SVGNode
Returns the hashstring of SVGNode
Removes tag from node, if it does not exist it does nothing.
Setter for the x attribute
Setter for the y attribute
Generated using TypeDoc
A JS Representation of a HTML-Node. More specifically, all the SVG Types Nodes.
Usage
import { SVGNode } from 'ts-svgmanager' // Initialize a circle with args const circle = new SVGNode('circle').r(5).cx(10).cy(20)
Important methods
SVGNode.set and SVGNode.get
Lets you set and get attributes, respectively
SVGNode.append
Will let you append a childnode
SVGNode.tag
Allows you to add a tag for later reference from the SVGManager
SVGNode.on
Creates a event listener on the node
SVGNode.text
Which allows you to set the innerText