HTML5 Canvas Select Shape by Id with KineticJS

To select a shape by id with KineticJS, we can use the get() method using the # selector.  The get() method always returns an array of elements, even if we are expecting it to return one element.  The get() method works for any node, including the stage, layers, groups, and shapes.

Instructions: press the "Activate Rectangle" button to select the rectangle by id and perform a transition.  You can also drag and drop the rectangle.

Open in new window

Code Editor

Modified on April 9th, 2013 by Eric Rowell
comments powered by Disqus