Elements API
Element Creation
#.createEl(ElementConfig):
createEl takes Element config as an input which contains element 'el' type with 'attr' attributes and 'style' properties.
Examples:
WebGL Shapes -- update this example
#.createEls(dataArray, ElementConfig)
CreateEls can be used to create more than one element, based on the data array. It accepts data array as a first argument and Element config as a second element. It creates elements for every data value. property values can be an access function, which receives data as an argument.
#.fetchEl(selector[,dataObject])
Fetches single child node for a given CSS selector. It also accepts data object as a second argument, optional param, to fetch based on bound data. It takes a simple CSS-selector as an input and returns Element instance.
#.fetchEls(selector[,dataArray])
Fetches multiple children for a given CSS selector. It also accepts data array as a second argument, optional param, to fetch based on bound data. It takes a simple CSS-selector as an input and returns Elements instance.
#.setAttr(key, value);
Set attributes. It takes either a single key, value pair, or an object as an argument. The Value of a property can be a function. if you send 'null' as
#.setStyle()
Set style properties to the element. It takes either a single key, value pair , or an object with multiple key-value pairs.
#.getAttr()
To fetch attribute value. It takes attribute name input, gives value as an output.
#.getStyle()
To fetch DOM style value. It takes style property input, gives value as an output.
#.animateTo()
To perform animation transitions of one or more elements from the current state to the target state in a given duration(ms).
#.interrupt()
To interrupt transitions on the context node. By calling the interrupt it kills all the transitions on the node.
#.on(eventType, eventHndlr)
To bind event handlers on the graphical element. Accepts eventType and eventHandler as arguments. The handler receives the event object as an argument.
#.node()
API to fetch Dom node. Returns Dom object(SVG) and VDom node(Canvas/WebGL).
#.data()
API to fetch/set data bound to the graphical node.
#.remove()
API to remove the current element from the parent element. Node on which remove invoked will be removed from the parent's children list
#.removeChild(childNode)
API to remove the child from its child's list. Takes node instance as an argument.
Last updated