mirror of
https://github.com/konvajs/konva.git
synced 2025-07-15 09:18:07 +08:00
fixed all jshint errors except for Path, Mask, and Blur
This commit is contained in:
parent
77793aed60
commit
98dff50c93
@ -160,5 +160,5 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('dev', ['clean', 'concat:source', 'replace:dev']);
|
||||
grunt.registerTask('full', ['clean', 'concat:source', 'replace:dev', 'uglify', 'replace:prod']);
|
||||
grunt.registerTask('test', ['concat:test']);
|
||||
grunt.registerTask('hint', ['jshint']);
|
||||
grunt.registerTask('hint', ['clean', 'concat:source', 'replace:dev', 'jshint']);
|
||||
};
|
@ -8,10 +8,10 @@
|
||||
StackBlur - a fast almost Gaussian Blur For Canvas
|
||||
|
||||
Version: 0.5
|
||||
Author: Mario Klingemann
|
||||
Contact: mario@quasimondo.com
|
||||
Website: http://www.quasimondo.com/StackBlurForCanvas
|
||||
Twitter: @quasimondo
|
||||
Author: Mario Klingemann
|
||||
Contact: mario@quasimondo.com
|
||||
Website: http://www.quasimondo.com/StackBlurForCanvas
|
||||
Twitter: @quasimondo
|
||||
|
||||
In case you find this class useful - especially in commercial projects -
|
||||
I am not totally unhappy for a small donation to my PayPal account
|
||||
|
@ -34,13 +34,17 @@
|
||||
this._setDrawFuncs();
|
||||
},
|
||||
drawFunc: function(canvas) {
|
||||
var context = canvas.getContext(), sides = this.attrs.sides, radius = this.attrs.radius;
|
||||
var context = canvas.getContext(),
|
||||
sides = this.attrs.sides,
|
||||
radius = this.attrs.radius,
|
||||
n, x, y;
|
||||
|
||||
context.beginPath();
|
||||
context.moveTo(0, 0 - radius);
|
||||
|
||||
for(var n = 1; n < sides; n++) {
|
||||
var x = radius * Math.sin(n * 2 * Math.PI / sides);
|
||||
var y = -1 * radius * Math.cos(n * 2 * Math.PI / sides);
|
||||
for(n = 1; n < sides; n++) {
|
||||
x = radius * Math.sin(n * 2 * Math.PI / sides);
|
||||
y = -1 * radius * Math.cos(n * 2 * Math.PI / sides);
|
||||
context.lineTo(x, y);
|
||||
}
|
||||
context.closePath();
|
||||
|
@ -31,15 +31,19 @@
|
||||
this.className = 'Blob';
|
||||
},
|
||||
drawFunc: function(canvas) {
|
||||
var points = this.getPoints(), length = points.length, context = canvas.getContext(), tension = this.getTension();
|
||||
var points = this.getPoints(),
|
||||
length = points.length,
|
||||
context = canvas.getContext(),
|
||||
tension = this.getTension(),
|
||||
ap, len, n, point;
|
||||
|
||||
context.beginPath();
|
||||
context.moveTo(points[0].x, points[0].y);
|
||||
|
||||
// tension
|
||||
if(tension !== 0 && length > 2) {
|
||||
var ap = this.allPoints,
|
||||
len = ap.length,
|
||||
n, point;
|
||||
ap = this.allPoints;
|
||||
len = ap.length;
|
||||
|
||||
while(n < len-1) {
|
||||
context.bezierCurveTo(ap[n].x, ap[n++].y, ap[n].x, ap[n++].y, ap[n].x, ap[n++].y);
|
||||
|
@ -1,4 +1,7 @@
|
||||
(function() {
|
||||
var PIx2 = Math.PI * 2,
|
||||
CIRCLE = 'Circle';
|
||||
|
||||
/**
|
||||
* Circle constructor
|
||||
* @constructor
|
||||
@ -36,13 +39,14 @@
|
||||
this.createAttrs();
|
||||
// call super constructor
|
||||
Kinetic.Shape.call(this, config);
|
||||
this.className = 'Circle';
|
||||
this.className = CIRCLE;
|
||||
this._setDrawFuncs();
|
||||
},
|
||||
drawFunc: function(canvas) {
|
||||
var context = canvas.getContext();
|
||||
var context = canvas.getContext();
|
||||
|
||||
context.beginPath();
|
||||
context.arc(0, 0, this.getRadius(), 0, Math.PI * 2, true);
|
||||
context.arc(0, 0, this.getRadius(), 0, PIx2, true);
|
||||
context.closePath();
|
||||
canvas.fillStroke(this);
|
||||
},
|
||||
|
@ -55,27 +55,33 @@
|
||||
this.className = 'Spline';
|
||||
},
|
||||
drawFunc: function(canvas) {
|
||||
var points = this.getPoints(), length = points.length, context = canvas.getContext(), tension = this.getTension();
|
||||
var points = this.getPoints(),
|
||||
length = points.length,
|
||||
context = canvas.getContext(),
|
||||
tension = this.getTension(),
|
||||
ap, len, n, point;
|
||||
|
||||
context.beginPath();
|
||||
context.moveTo(points[0].x, points[0].y);
|
||||
|
||||
// tension
|
||||
if(tension !== 0 && length > 2) {
|
||||
var ap = this.allPoints, len = ap.length;
|
||||
ap = this.allPoints;
|
||||
len = ap.length;
|
||||
n = 2;
|
||||
|
||||
context.quadraticCurveTo(ap[0].x, ap[0].y, ap[1].x, ap[1].y);
|
||||
|
||||
var n = 2;
|
||||
while(n < len - 1) {
|
||||
context.bezierCurveTo(ap[n].x, ap[n++].y, ap[n].x, ap[n++].y, ap[n].x, ap[n++].y);
|
||||
}
|
||||
|
||||
context.quadraticCurveTo(ap[len - 1].x, ap[len - 1].y, points[length - 1].x, points[length - 1].y);
|
||||
|
||||
}
|
||||
// no tension
|
||||
else {
|
||||
for(var n = 1; n < length; n++) {
|
||||
var point = points[n];
|
||||
for(n = 1; n < length; n++) {
|
||||
point = points[n];
|
||||
context.lineTo(point.x, point.y);
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@
|
||||
*/
|
||||
Kinetic.Sprite = function(config) {
|
||||
this._initSprite(config);
|
||||
}
|
||||
};
|
||||
|
||||
Kinetic.Sprite.prototype = {
|
||||
_initSprite: function(config) {
|
||||
|
Loading…
Reference in New Issue
Block a user