Command Chaining
Command chaining is the ability to chain commands together into one long line. This is the same technique jQuery uses so well to traverse the DOM. Similar to jQuery, Burst assumes the last node as being 'current' when creating a chain. For example: the current node is the property track named "fill" in this example:
Burst.timeline("myTimeline").shape("myShape").track("fill")
Burst, timeline, shape and track are all 'Objects'. When you call an object, it returns it's self. So Burst.timeline("myTimeline").left = 100; will change myTimeline's left property. But if you wanted to change properties of multiple objects you would do this:
Burst.timeline("myTimeline").track("left").key(0, 100)
.shape("myShape").track("left").key(0, 100)
.shape("myOtherShape").track("left").key(0, 100);
Quick Node Traversal
Different to jQuery, back-tracking up the chain is possible with out referencing having to use .parent(). When you want to access a parent node, simple call it's name again like so:
01 Burst.timeline("myTimeline")
02 .shape("SHAPE1")
03 .track("left").key(0, 100)
04 .shape("SHAPE2")
05 .track("left").key(0, 200)
06 .shape("SHAPE1")
07 .track("left").key(0, 100);
As you can see on line 6, "shape1" is being re-accessed without any reference to it's location in the object model. This task is performed by an internal lookup that references the original object if it already exists. If it does not exist, a new object is created with this name and returned as the current node.
NOTE: It impossible to create 2 objects of the same class with the same name. If you try, the original object with the same name will be returned as the current object.