HTML5 Canvas Move Shape to Another Container with KineticJS

To move a shape from one container into another with KineticJS, we can use the moveTo() method which requires a container as a parameter.  A container can be another stage, a layer, or a group.  You can also move groups into other groups and layers, or shapes from groups directly into other layers.

Instructions: Drag and drop the groups and observe that the red rectangle is bound to either the yellow group or the blue group.  Use the buttons on the left to move the box from one group into another.

new window

Code Editor

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