mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 09:50:05 +08:00
added more example docs
This commit is contained in:
@@ -118,7 +118,7 @@
|
||||
* // remove listener<br>
|
||||
* node.off('click');<br><br>
|
||||
*
|
||||
* // remove multiple listener<br>
|
||||
* // remove multiple listeners<br>
|
||||
* node.off('click touchstart');<br><br>
|
||||
*
|
||||
* // remove listener by name<br>
|
||||
@@ -414,7 +414,7 @@
|
||||
* // set x only<br>
|
||||
* node.setPosition({<br>
|
||||
* x: 5<br>
|
||||
* });<br>
|
||||
* });<br><br>
|
||||
*
|
||||
* // set x and y using an array<br>
|
||||
* node.setPosition([5, 10]);<br><br>
|
||||
|
@@ -17,7 +17,7 @@
|
||||
* tension: 0.8,<br>
|
||||
* fill: 'red',<br>
|
||||
* stroke: 'black'<br>
|
||||
* strokeWidth: 5
|
||||
* strokeWidth: 5<br>
|
||||
* });
|
||||
*/
|
||||
Kinetic.Blob = function(config) {
|
||||
|
@@ -14,17 +14,17 @@
|
||||
* radius: 5,<br>
|
||||
* fill: 'red',<br>
|
||||
* stroke: 'black'<br>
|
||||
* strokeWidth: 5
|
||||
* });
|
||||
* strokeWidth: 5<br>
|
||||
* });<br><br>
|
||||
*
|
||||
* // create ellipse
|
||||
* // create ellipse<br>
|
||||
* var circle = new Kinetic.Circle({<br>
|
||||
* radius: 5,<br>
|
||||
* fill: 'red',<br>
|
||||
* stroke: 'black'<br>
|
||||
* strokeWidth: 5,<br>
|
||||
* scaleX: 2,<br>
|
||||
* strokeScaleEnabled: false
|
||||
* strokeScaleEnabled: false<br>
|
||||
* });
|
||||
*/
|
||||
Kinetic.Circle = function(config) {
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* height: 50,<br>
|
||||
* fill: 'red',<br>
|
||||
* stroke: 'black'<br>
|
||||
* strokeWidth: 5
|
||||
* strokeWidth: 5<br>
|
||||
* });
|
||||
*/
|
||||
Kinetic.Rect = function(config) {
|
||||
|
@@ -8,9 +8,63 @@
|
||||
* @param {String} config.animation animation key
|
||||
* @param {Object} config.animations animation map
|
||||
* @param {Integer} [config.index] animation index
|
||||
* @param {Image} image image object
|
||||
* @param {Image} config.image image object
|
||||
* {{ShapeParams}}
|
||||
* {{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) {
|
||||
this._initSprite(config);
|
||||
|
Reference in New Issue
Block a user