added more example docs

This commit is contained in:
Eric Rowell
2013-05-17 15:35:21 -07:00
parent 7c03f56ae9
commit 4d682529b6
5 changed files with 63 additions and 9 deletions

View File

@@ -118,7 +118,7 @@
* // remove listener<br> * // remove listener<br>
* node.off('click');<br><br> * node.off('click');<br><br>
* *
* // remove multiple listener<br> * // remove multiple listeners<br>
* node.off('click touchstart');<br><br> * node.off('click touchstart');<br><br>
* *
* // remove listener by name<br> * // remove listener by name<br>
@@ -414,7 +414,7 @@
* // set x only<br> * // set x only<br>
* node.setPosition({<br> * node.setPosition({<br>
* x: 5<br> * x: 5<br>
* });<br> * });<br><br>
* *
* // set x and y using an array<br> * // set x and y using an array<br>
* node.setPosition([5, 10]);<br><br> * node.setPosition([5, 10]);<br><br>

View File

@@ -17,7 +17,7 @@
* tension: 0.8,<br> * tension: 0.8,<br>
* fill: 'red',<br> * fill: 'red',<br>
* stroke: 'black'<br> * stroke: 'black'<br>
* strokeWidth: 5 * strokeWidth: 5<br>
* }); * });
*/ */
Kinetic.Blob = function(config) { Kinetic.Blob = function(config) {

View File

@@ -14,17 +14,17 @@
* radius: 5,<br> * radius: 5,<br>
* fill: 'red',<br> * fill: 'red',<br>
* stroke: 'black'<br> * stroke: 'black'<br>
* strokeWidth: 5 * strokeWidth: 5<br>
* }); * });<br><br>
* *
* // create ellipse * // create ellipse<br>
* var circle = new Kinetic.Circle({<br> * var circle = new Kinetic.Circle({<br>
* radius: 5,<br> * radius: 5,<br>
* fill: 'red',<br> * fill: 'red',<br>
* stroke: 'black'<br> * stroke: 'black'<br>
* strokeWidth: 5,<br> * strokeWidth: 5,<br>
* scaleX: 2,<br> * scaleX: 2,<br>
* strokeScaleEnabled: false * strokeScaleEnabled: false<br>
* }); * });
*/ */
Kinetic.Circle = function(config) { Kinetic.Circle = function(config) {

View File

@@ -14,7 +14,7 @@
* height: 50,<br> * height: 50,<br>
* fill: 'red',<br> * fill: 'red',<br>
* stroke: 'black'<br> * stroke: 'black'<br>
* strokeWidth: 5 * strokeWidth: 5<br>
* }); * });
*/ */
Kinetic.Rect = function(config) { Kinetic.Rect = function(config) {

View File

@@ -8,9 +8,63 @@
* @param {String} config.animation animation key * @param {String} config.animation animation key
* @param {Object} config.animations animation map * @param {Object} config.animations animation map
* @param {Integer} [config.index] animation index * @param {Integer} [config.index] animation index
* @param {Image} image image object * @param {Image} config.image image object
* {{ShapeParams}} * {{ShapeParams}}
* {{NodeParams}} * {{NodeParams}}
* @example
* var animations = {<br>
* idle: [{<br>
* x: 2,<br>
* y: 2,<br>
* width: 70,<br>
* height: 119<br>
* }, {<br>
* x: 71,<br>
* y: 2,<br>
* width: 74,<br>
* height: 119<br>
* }, {<br>
* x: 146,<br>
* y: 2,<br>
* width: 81,<br>
* height: 119<br>
* }, {<br>
* x: 226,<br>
* y: 2,<br>
* width: 76,<br>
* height: 119<br>
* }],<br>
* punch: [{<br>
* x: 2,<br>
* y: 138,<br>
* width: 74,<br>
* height: 122<br>
* }, {<br>
* x: 76,<br>
* y: 138,<br>
* width: 84,<br>
* height: 122<br>
* }, {<br>
* x: 346,<br>
* y: 138,<br>
* width: 120,<br>
* height: 122<br>
* }]<br>
* };<br><br>
*
* var imageObj = new Image();<br>
* imageObj.onload = function() {<br>
* var sprite = new Kinetic.Sprite({<br>
* x: 200,<br>
* y: 100,<br>
* image: imageObj,<br>
* animation: 'idle',<br>
* animations: animations,<br>
* frameRate: 7,<br>
* index: 0<br>
* });<br>
* };<br>
* imageObj.src = '/path/to/image.jpg'
*/ */
Kinetic.Sprite = function(config) { Kinetic.Sprite = function(config) {
this._initSprite(config); this._initSprite(config);