To create a custom shape with KineticJS, we can instantiate a Kinetic.Shape() object. When creating a custom shape, we need to define a drawing function that is passed a Kinetic.Canvas renderer. We can use the renderer to access the HTML5 Canvas context, and to use special methods like canvas.fillStroke() which automatically handles filling, stroking, and applying shadows. For a full list of attributes and methods, check out the Kinetic.Shape documentation and the Kinetic.Canvas documentation.
Code Editor
Modified on May 17th, 2013
by Eric Rowell