continued working on Shape docs

This commit is contained in:
Eric Rowell
2014-01-11 20:54:57 -08:00
parent 0e0c92da18
commit 2c5f332706
2 changed files with 169 additions and 178 deletions

View File

@@ -1528,7 +1528,7 @@
* // set position<br> * // set position<br>
* node.position({<br> * node.position({<br>
* x: 5<br> * x: 5<br>
* y: 10 * y: 10<br>
* }); * });
*/ */
@@ -1882,7 +1882,7 @@
* node.filters([<br> * node.filters([<br>
* Kinetic.Filters.Blur,<br> * Kinetic.Filters.Blur,<br>
* Kinetic.Filters.Sepia,<br> * Kinetic.Filters.Sepia,<br>
* Kinetic.Filters.Invert * Kinetic.Filters.Invert<br>
* ]); * ]);
*/ */

View File

@@ -281,19 +281,19 @@
* @param {String} color * @param {String} color
* @returns {String} * @returns {String}
* @example * @example
* // get stroke color * // get stroke color<br>
* var stroke = shape.stroke(); * var stroke = shape.stroke();<br><br>
* *
* // set stroke color with color string * // set stroke color with color string<br>
* shape.stroke('green'); * shape.stroke('green');<br><br>
* *
* // set stroke color with hex * // set stroke color with hex<br>
* shape.stroke('#00ff00'); * shape.stroke('#00ff00');<br><br>
* *
* // set stroke color with rgb * // set stroke color with rgb<br>
* shape.stroke('rgb(0,255,0)'); * shape.stroke('rgb(0,255,0)');<br><br>
* *
* // set stroke color with rgba and make it 50% opaque * // set stroke color with rgba and make it 50% opaque<br>
* shape.stroke('rgba(0,255,0,0.5'); * shape.stroke('rgba(0,255,0,0.5');
*/ */
@@ -317,10 +317,10 @@
* @param {Integer} red * @param {Integer} red
* @returns {Integer} * @returns {Integer}
* @example * @example
* // get stroke red component * // get stroke red component<br>
* var strokeRed = shape.strokeRed(); * var strokeRed = shape.strokeRed();<br><br>
* *
* // set stroke red component * // set stroke red component<br>
* shape.strokeRed(0); * shape.strokeRed(0);
*/ */
@@ -344,10 +344,10 @@
* @param {Integer} green * @param {Integer} green
* @returns {Integer} * @returns {Integer}
* @example * @example
* // get stroke green component * // get stroke green component<br>
* var strokeGreen = shape.strokeGreen(); * var strokeGreen = shape.strokeGreen();<br><br>
* *
* // set stroke green component * // set stroke green component<br>
* shape.strokeGreen(255); * shape.strokeGreen(255);
*/ */
@@ -371,10 +371,10 @@
* @param {Integer} blue * @param {Integer} blue
* @returns {Integer} * @returns {Integer}
* @example * @example
* // get stroke blue component * // get stroke blue component<br>
* var strokeBlue = shape.strokeBlue(); * var strokeBlue = shape.strokeBlue();<br><br>
* *
* // set stroke blue component * // set stroke blue component<br>
* shape.strokeBlue(0); * shape.strokeBlue(0);
*/ */
@@ -388,10 +388,10 @@
* @param {Number} strokeWidth * @param {Number} strokeWidth
* @returns {Number} * @returns {Number}
* @example * @example
* // get stroke width * // get stroke width<br>
* var strokeWidth = shape.strokeWidth(); * var strokeWidth = shape.strokeWidth();<br><br>
* *
* // set stroke width * // set stroke width<br>
* shape.strokeWidth(); * shape.strokeWidth();
*/ */
@@ -406,10 +406,10 @@
* @param {String} lineJoin * @param {String} lineJoin
* @returns {String} * @returns {String}
* @example * @example
* // get line join * // get line join<br>
* var lineJoin = shape.lineJoin(); * var lineJoin = shape.lineJoin();<br><br>
* *
* // set line join * // set line join<br>
* shape.lineJoin('round'); * shape.lineJoin('round');
*/ */
@@ -423,10 +423,10 @@
* @param {String} lineCap * @param {String} lineCap
* @returns {String} * @returns {String}
* @example * @example
* // get line cap * // get line cap<br>
* var lineCap = shape.lineCap(); * var lineCap = shape.lineCap();<br><br>
* *
* // set line cap * // set line cap<br>
* shape.lineCap('round'); * shape.lineCap('round');
*/ */
@@ -440,15 +440,15 @@
* @param {Function} drawFunc drawing function * @param {Function} drawFunc drawing function
* @returns {Function} * @returns {Function}
* @example * @example
* // get scene draw function * // get scene draw function<br>
* var sceneFunc = shape.sceneFunc(); * var sceneFunc = shape.sceneFunc();<br><br>
* *
* // set scene draw function * // set scene draw function<br>
* shape.sceneFunc(function(context) { * shape.sceneFunc(function(context) {<br>
* context.beginPath(); * context.beginPath();<br>
* context.rect(0, 0, this.width(), this.height()); * context.rect(0, 0, this.width(), this.height());<br>
* context.closePath(); * context.closePath();<br>
* context.fillStrokeShape(this); * context.fillStrokeShape(this);<br>
* }); * });
*/ */
@@ -462,15 +462,15 @@
* @param {Function} drawFunc drawing function * @param {Function} drawFunc drawing function
* @returns {Function} * @returns {Function}
* @example * @example
* // get hit draw function * // get hit draw function<br>
* var hitFunc = shape.hitFunc(); * var hitFunc = shape.hitFunc();<br><br>
* *
* // set hit draw function * // set hit draw function<br>
* shape.hitFunc(function(context) { * shape.hitFunc(function(context) {<br>
* context.beginPath(); * context.beginPath();<br>
* context.rect(0, 0, this.width(), this.height()); * context.rect(0, 0, this.width(), this.height());<br>
* context.closePath(); * context.closePath();<br>
* context.fillStrokeShape(this); * context.fillStrokeShape(this);<br>
* }); * });
*/ */
@@ -504,19 +504,19 @@
* @param {String} color * @param {String} color
* @returns {String} * @returns {String}
* @example * @example
* // get shadow color * // get shadow color<br>
* var shadow = shape.shadowColor(); * var shadow = shape.shadowColor();<br><br>
* *
* // set shadow color with color string * // set shadow color with color string<br>
* shape.shadowColor('green'); * shape.shadowColor('green');<br><br>
* *
* // set shadow color with hex * // set shadow color with hex<br>
* shape.shadowColor('#00ff00'); * shape.shadowColor('#00ff00');<br><br>
* *
* // set shadow color with rgb * // set shadow color with rgb<br>
* shape.shadowColor('rgb(0,255,0)'); * shape.shadowColor('rgb(0,255,0)');<br><br>
* *
* // set shadow color with rgba and make it 50% opaque * // set shadow color with rgba and make it 50% opaque<br>
* shape.shadowColor('rgba(0,255,0,0.5'); * shape.shadowColor('rgba(0,255,0,0.5');
*/ */
@@ -540,10 +540,10 @@
* @param {Integer} red * @param {Integer} red
* @returns {Integer} * @returns {Integer}
* @example * @example
* // get shadow red component * // get shadow red component<br>
* var shadowRed = shape.shadowRed(); * var shadowRed = shape.shadowRed();<br><br>
* *
* // set shadow red component * // set shadow red component<br>
* shape.shadowRed(0); * shape.shadowRed(0);
*/ */
@@ -567,10 +567,10 @@
* @param {Integer} green * @param {Integer} green
* @returns {Integer} * @returns {Integer}
* @example * @example
* // get shadow green component * // get shadow green component<br>
* var shadowGreen = shape.shadowGreen(); * var shadowGreen = shape.shadowGreen();<br><br>
* *
* // set shadow green component * // set shadow green component<br>
* shape.shadowGreen(255); * shape.shadowGreen(255);
*/ */
@@ -594,10 +594,10 @@
* @param {Integer} blue * @param {Integer} blue
* @returns {Integer} * @returns {Integer}
* @example * @example
* // get shadow blue component * // get shadow blue component<br>
* var shadowBlue = shape.shadowBlue(); * var shadowBlue = shape.shadowBlue();<br><br>
* *
* // set shadow blue component * // set shadow blue component<br>
* shape.shadowBlue(0); * shape.shadowBlue(0);
*/ */
@@ -611,10 +611,10 @@
* @param {Number} blur * @param {Number} blur
* @returns {Number} * @returns {Number}
* @example * @example
* // get shadow blur * // get shadow blur<br>
* var shadowBlur = shape.shadowBlur(); * var shadowBlur = shape.shadowBlur();<br><br>
* *
* // set shadow blur * // set shadow blur<br>
* shape.shadowBlur(10); * shape.shadowBlur(10);
*/ */
@@ -628,10 +628,10 @@
* @param {Number} opacity * @param {Number} opacity
* @returns {Number} * @returns {Number}
* @example * @example
* // get shadow opacity * // get shadow opacity<br>
* var shadowOpacity = shape.shadowOpacity(); * var shadowOpacity = shape.shadowOpacity();<br><br>
* *
* // set shadow opacity * // set shadow opacity<br>
* shape.shadowOpacity(0.5); * shape.shadowOpacity(0.5);
*/ */
@@ -647,13 +647,13 @@
* @param {Number} offset.y * @param {Number} offset.y
* @returns {Object} * @returns {Object}
* @example * @example
* // get shadow offset * // get shadow offset<br>
* var shadowOffset = shape.shadowOffset(); * var shadowOffset = shape.shadowOffset();<br><br>
* *
* // set shadow offset * // set shadow offset<br>
* shape.shadowOffset({ * shape.shadowOffset({<br>
* x: 20 * x: 20<br>
* y: 10 * y: 10<br>
* }); * });
*/ */
@@ -667,10 +667,10 @@
* @param {Number} x * @param {Number} x
* @returns {Number} * @returns {Number}
* @example * @example
* // get shadow offset x * // get shadow offset x<br>
* var shadowOffsetX = shape.shadowOffsetX(); * var shadowOffsetX = shape.shadowOffsetX();<br><br>
* *
* // set shadow offset x * // set shadow offset x<br>
* shape.shadowOffsetX(5); * shape.shadowOffsetX(5);
*/ */
@@ -684,10 +684,10 @@
* @param {Number} y * @param {Number} y
* @returns {Number} * @returns {Number}
* @example * @example
* // get shadow offset yx * // get shadow offset y<br>
* var shadowOffsetY = shape.shadowOffsetY(); * var shadowOffsetY = shape.shadowOffsetY();<br><br>
* *
* // set shadow offset y * // set shadow offset y<br>
* shape.shadowOffsetY(5); * shape.shadowOffsetY(5);
*/ */
@@ -701,14 +701,14 @@
* @param {Image} image object * @param {Image} image object
* @returns {Image} * @returns {Image}
* @example * @example
* // get fill pattern image * // get fill pattern image<br>
* var fillPatternImage = shape.fillPatternImage(); * var fillPatternImage = shape.fillPatternImage();<br><br>
* *
* // set fill pattern image * // set fill pattern image<br>
* var imageObj = new Image(); * var imageObj = new Image();<br>
* imageObj.onload = function() { * imageObj.onload = function() {<br>
* shape.fillPatternImage(imageObj); * shape.fillPatternImage(imageObj);<br>
* }; * };<br>
* imageObj.src = 'path/to/image/jpg'; * imageObj.src = 'path/to/image/jpg';
*/ */
@@ -722,19 +722,19 @@
* @param {String} color * @param {String} color
* @returns {String} * @returns {String}
* @example * @example
* // get fill color * // get fill color<br>
* var fill = shape.fill(); * var fill = shape.fill();<br><br>
* *
* // set fill color with color string * // set fill color with color string<br>
* shape.fill('green'); * shape.fill('green');<br><br>
* *
* // set fill color with hex * // set fill color with hex<br>
* shape.fill('#00ff00'); * shape.fill('#00ff00');<br><br>
* *
* // set fill color with rgb * // set fill color with rgb<br>
* shape.fill('rgb(0,255,0)'); * shape.fill('rgb(0,255,0)');<br><br>
* *
* // set fill color with rgba and make it 50% opaque * // set fill color with rgba and make it 50% opaque<br>
* shape.fill('rgba(0,255,0,0.5'); * shape.fill('rgba(0,255,0,0.5');
*/ */
@@ -758,10 +758,10 @@
* @param {Integer} red * @param {Integer} red
* @returns {Integer} * @returns {Integer}
* @example * @example
* // get fill red component * // get fill red component<br>
* var fillRed = shape.fillRed(); * var fillRed = shape.fillRed();<br><br>
* *
* // set fill red component * // set fill red component<br>
* shape.fillRed(0); * shape.fillRed(0);
*/ */
@@ -785,10 +785,10 @@
* @param {Integer} green * @param {Integer} green
* @returns {Integer} * @returns {Integer}
* @example * @example
* // get fill green component * // get fill green component<br>
* var fillGreen = shape.fillGreen(); * var fillGreen = shape.fillGreen();<br><br>
* *
* // set fill green component * // set fill green component<br>
* shape.fillGreen(255); * shape.fillGreen(255);
*/ */
@@ -812,10 +812,10 @@
* @param {Integer} blue * @param {Integer} blue
* @returns {Integer} * @returns {Integer}
* @example * @example
* // get fill blue component * // get fill blue component<br>
* var fillBlue = shape.fillBlue(); * var fillBlue = shape.fillBlue();<br><br>
* *
* // set fill blue component * // set fill blue component<br>
* shape.fillBlue(0); * shape.fillBlue(0);
*/ */
@@ -824,134 +824,125 @@
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternX', 0); Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternX', 0);
/** /**
* set fill pattern x * get/set fill pattern x
* @name setFillPatternX * @name fillPatternX
* @method * @method
* @memberof Kinetic.Shape.prototype * @memberof Kinetic.Shape.prototype
* @param {Number} x * @param {Number} x
* @returns {Kinetic.Shape}
*/
/**
* get fill pattern x
* @name getFillPatternX
* @method
* @memberof Kinetic.Shape.prototype
* @returns {Number} * @returns {Number}
* @example
* // get fill pattern x
* var fillPatternX = shape.fillPatternX();
*
* // set fill pattern x
* shape.fillPatternX(20);
*/ */
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternY', 0); Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternY', 0);
/** /**
* set fill pattern y * get/set fill pattern y
* @name setFillPatternY * @name fillPatternY
* @method * @method
* @memberof Kinetic.Shape.prototype * @memberof Kinetic.Shape.prototype
* @param {Number} y * @param {Number} y
* @returns {Kinetic.Shape}
*/
/**
* get fill pattern y
* @name getFillPatternY
* @method
* @memberof Kinetic.Shape.prototype
* @returns {Number} * @returns {Number}
* @example
* // get fill pattern y
* var fillPatternY = shape.fillPatternY();
*
* // set fill pattern y
* shape.fillPatternY(20);
*/ */
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillLinearGradientColorStops'); Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillLinearGradientColorStops');
/** /**
* set fill linear gradient color stops * get/set fill linear gradient color stops
* @name setFillLinearGradientColorStops * @name fillLinearGradientColorStops
* @method * @method
* @memberof Kinetic.Shape.prototype * @memberof Kinetic.Shape.prototype
* @param {Array} colorStops * @param {Array} colorStops
* @returns {Kinetic.Shape}
*/
/**
* get fill linear gradient color stops
* @name getFillLinearGradientColorStops
* @method
* @memberof Kinetic.Shape.prototype
* @returns {Array} colorStops * @returns {Array} colorStops
* @example
* // get fill linear gradient color stops
* var colorStops = shape.fillLinearGradientColorStops();
*
* // create a linear gradient that starts with red, changes to blue
* // halfway through, and then changes to green
* shape.fillLinearGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green');
*/ */
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientStartRadius', 0); Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientStartRadius', 0);
/** /**
* set fill radial gradient start radius * get/set fill radial gradient start radius
* @name setFillRadialGradientStartRadius * @name fillRadialGradientStartRadius
* @method * @method
* @memberof Kinetic.Shape.prototype * @memberof Kinetic.Shape.prototype
* @param {Number} radius * @param {Number} radius
* @returns {Kinetic.Shape}
*/
/**
* get fill radial gradient start radius
* @name getFillRadialGradientStartRadius
* @method
* @memberof Kinetic.Shape.prototype
* @returns {Number} * @returns {Number}
* @example
* // get radial gradient start radius
* var startRadius = shape.fillRadialGradientStartRadius();
*
* // set radial gradient start radius
* shape.fillRadialGradientStartRadius(0);
*/ */
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientEndRadius', 0); Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientEndRadius', 0);
/** /**
* set fill radial gradient end radius * get/set fill radial gradient end radius
* @name setFillRadialGradientEndRadius * @name fillRadialGradientEndRadius
* @method * @method
* @memberof Kinetic.Shape.prototype * @memberof Kinetic.Shape.prototype
* @param {Number} radius * @param {Number} radius
* @returns {Kinetic.Shape}
*/
/**
* get fill radial gradient end radius
* @name getFillRadialGradientEndRadius
* @method
* @memberof Kinetic.Shape.prototype
* @returns {Number} * @returns {Number}
* @example
* // get radial gradient end radius
* var endRadius = shape.fillRadialGradientEndRadius();
*
* // set radial gradient end radius
* shape.fillRadialGradientEndRadius(100);
*/ */
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientColorStops'); Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillRadialGradientColorStops');
/** /**
* set fill radial gradient color stops * get/set fill radial gradient color stops
* @name setFillRadialGradientColorStops * @name fillRadialGradientColorStops
* @method * @method
* @memberof Kinetic.Shape.prototype * @memberof Kinetic.Shape.prototype
* @param {Number} colorStops * @param {Number} colorStops
* @returns {Kinetic.Shape}
*/
/**
* get fill radial gradient color stops
* @name getFillRadialGradientColorStops
* @method
* @memberof Kinetic.Shape.prototype
* @returns {Array} * @returns {Array}
* @example
* // get fill radial gradient color stops
* var colorStops = shape.fillRadialGradientColorStops();
*
* // create a radial gradient that starts with red, changes to blue
* // halfway through, and then changes to green
* shape.fillRadialGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green');
*/ */
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternRepeat'); Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillPatternRepeat', 'repeat');
/** /**
* set fill pattern repeat * get/set fill pattern repeat. Can be 'repeat', 'repeat-x', 'repeat-y', or 'no-repeat'. The default is 'repeat'
* @name setFillPatternRepeat * @name fillPatternRepeat
* @method
* @memberof Kinetic.Shape.prototype
* @param {Number} repeat can be 'repeat', 'repeat-x', 'repeat-y', or 'no-repeat'. The default is 'no-repeat'
* @returns {Kinetic.Shape}
*/
/**
* get fill pattern repeat
* @name getFillPatternRepeat
* @method * @method
* @memberof Kinetic.Shape.prototype * @memberof Kinetic.Shape.prototype
* @param {String} repeat
* @returns {String} * @returns {String}
* @example
* // get fill pattern repeat
* var repeat = shape.fillPatternRepeat();
*
* // repeat pattern in x direction only
* shape.fillPatternRepeat('repeat-x');
*
* // do not repeat the pattern
* shape.fillPatternRepeat('no repeat');
*/ */
Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillEnabled', true); Kinetic.Factory.addGetterSetter(Kinetic.Shape, 'fillEnabled', true);