mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 09:50:05 +08:00
finished base constructor examples for core shape docs
This commit is contained in:
12
src/Node.js
12
src/Node.js
@@ -800,16 +800,18 @@
|
||||
}
|
||||
},
|
||||
/**
|
||||
* clone node. Returns a new Node instance with identical attributes
|
||||
* clone node. Returns a new Node instance with identical attributes. You can also override
|
||||
* the node properties with an object literal, enabling you to use an existing node as a template
|
||||
* for another node
|
||||
* @method
|
||||
* @memberof Kinetic.Node.prototype
|
||||
* @param {Object} attrs override attrs
|
||||
* @example
|
||||
* // clone a rectangle<br>
|
||||
* var rectClone = rect.clone();<br><br>
|
||||
* // simple clone<br>
|
||||
* var clone = node.clone();<br><br>
|
||||
*
|
||||
* // clone a rectangle, but override the x position<br>
|
||||
* var rectClone = rect.clone({<br>
|
||||
* // clone a node and override the x position<br>
|
||||
* var clone = rect.clone({<br>
|
||||
* x: 5<br>
|
||||
* });
|
||||
*/
|
||||
|
@@ -75,9 +75,9 @@
|
||||
},
|
||||
/**
|
||||
* determines if point is in the shape, regardless if other shapes are on top of it. Note: because
|
||||
* this method clears a temp hit canvas, and redraws the shape, it performs very poorly if executed many times
|
||||
* consecutively. Please use the {@link Kinetic.Stage#getIntersection} method if at all possible
|
||||
* because it performs much better
|
||||
* this method clears a temporary canvas and then redraws the shape, it performs very poorly if executed many times
|
||||
* consecutively. Please use the {@link Kinetic.Stage#getIntersection} method if at all possible
|
||||
* because it performs much better
|
||||
* @method
|
||||
* @memberof Kinetic.Shape.prototype
|
||||
* @param {Object} point point can be an object containing
|
||||
|
@@ -253,7 +253,7 @@
|
||||
},
|
||||
/**
|
||||
* get visible intersection object that contains shape and pixel data. This is the preferred
|
||||
* method for determining if a point intersects a shape or not
|
||||
* method for determining if a point intersects a shape or not
|
||||
* @method
|
||||
* @memberof Kinetic.Stage.prototype
|
||||
* @param {Object} pos point object
|
||||
|
@@ -11,7 +11,7 @@
|
||||
* @example
|
||||
* // create simple circle
|
||||
* var circle = new Kinetic.Circle({<br>
|
||||
* radius: 5,<br>
|
||||
* radius: 40,<br>
|
||||
* fill: 'red',<br>
|
||||
* stroke: 'black'<br>
|
||||
* strokeWidth: 5<br>
|
||||
|
@@ -9,6 +9,27 @@
|
||||
* e.g. [0,1,2,3], [[0,1],[2,3]] and [{x:0,y:1},{x:2,y:3}] are equivalent
|
||||
* {{ShapeParams}}
|
||||
* {{NodeParams}}
|
||||
* @example
|
||||
* // simple line
|
||||
* var line = new Kinetic.Line({<br>
|
||||
* x: 100,<br>
|
||||
* y: 50,<br>
|
||||
* points: [73, 70, 340, 23, 450, 60, 500, 20],<br>
|
||||
* stroke: 'red'<br>
|
||||
* });<br><br>
|
||||
*
|
||||
* // dashed line with shadow<br>
|
||||
* var line = new Kinetic.Line({<br>
|
||||
* x: 100,<br>
|
||||
* y: 50,<br>
|
||||
* points: [73, 70, 340, 23, 450, 60, 500, 20],<br>
|
||||
* stroke: 'red',<br>
|
||||
* dashArray: [33, 10],<br>
|
||||
* shadowColor: 'black',<br>
|
||||
* shadowBlur: 10,<br>
|
||||
* shadowOffset: 10,<br>
|
||||
* shadowOpacity: 0.5<br>
|
||||
* });
|
||||
*/
|
||||
Kinetic.Line = function(config) {
|
||||
this._initLine(config);
|
||||
|
@@ -9,6 +9,13 @@
|
||||
* e.g. [0,1,2,3], [[0,1],[2,3]] and [{x:0,y:1},{x:2,y:3}] are equivalent
|
||||
* {{ShapeParams}}
|
||||
* {{NodeParams}}
|
||||
* @example
|
||||
* var polygon = new Kinetic.Polygon({<br>
|
||||
* points: [73, 192, 73, 160, 340, 23, 500, 109, 499, 139, 342, 93],<br>
|
||||
* fill: '#00D2FF',<br>
|
||||
* stroke: 'black',<br>
|
||||
* strokeWidth: 5<br>
|
||||
* });
|
||||
*/
|
||||
Kinetic.Polygon = function(config) {
|
||||
this._initPolygon(config);
|
||||
|
@@ -11,6 +11,14 @@
|
||||
* @param {Number} [config.tension] default value is 1. Higher values will result in a more curvy line. A value of 0 will result in no interpolation.
|
||||
* {{ShapeParams}}
|
||||
* {{NodeParams}}
|
||||
* @example
|
||||
* var spline = new Kinetic.Spline({<br>
|
||||
* x: 100,<br>
|
||||
* y: 50,<br>
|
||||
* points: [73, 70, 340, 23, 450, 60, 500, 20],<br>
|
||||
* stroke: 'red',<br>
|
||||
* tension: 1<br>
|
||||
* });
|
||||
*/
|
||||
Kinetic.Spline = function(config) {
|
||||
this._initSpline(config);
|
||||
|
@@ -45,6 +45,15 @@
|
||||
* @param {String} [config.wrap] can be word, char, or none. Default is word
|
||||
* {{ShapeParams}}
|
||||
* {{NodeParams}}
|
||||
* @example
|
||||
* var text = new Kinetic.Text({<br>
|
||||
* x: stage.getWidth() / 2,<br>
|
||||
* y: 15,<br>
|
||||
* text: 'Simple Text',<br>
|
||||
* fontSize: 30,<br>
|
||||
* fontFamily: 'Calibri',<br>
|
||||
* fill: 'green'<br>
|
||||
* });
|
||||
*/
|
||||
Kinetic.Text = function(config) {
|
||||
this._initText(config);
|
||||
|
@@ -10,6 +10,16 @@
|
||||
* @param {Boolean} [config.clockwise]
|
||||
* {{ShapeParams}}
|
||||
* {{NodeParams}}
|
||||
* @example
|
||||
* // draw a wedge that's pointing downwards<br>
|
||||
* var wedge = new Kinetic.Wedge({<br>
|
||||
* radius: 40,<br>
|
||||
* fill: 'red',<br>
|
||||
* stroke: 'black'<br>
|
||||
* strokeWidth: 5,<br>
|
||||
* angleDeg: 60,<br>
|
||||
* rotationDeg: -120<br>
|
||||
* });
|
||||
*/
|
||||
Kinetic.Wedge = function(config) {
|
||||
this._initWedge(config);
|
||||
|
Reference in New Issue
Block a user