mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Clean up code.
This commit is contained in:
parent
46a0589547
commit
2f63a65ded
2 changed files with 10 additions and 9 deletions
|
@ -51,7 +51,7 @@ var GrayColor = Color.extend({
|
||||||
|
|
||||||
toString: function() {
|
toString: function() {
|
||||||
return '{ gray: ' + this.gray
|
return '{ gray: ' + this.gray
|
||||||
+ ((this.alpha != -1) ? ', alpha: ' + this.alpha : '')
|
+ (this.alpha != -1 ? ', alpha: ' + this.alpha : '')
|
||||||
+ ' }';
|
+ ' }';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ var GrayColor = Color.extend({
|
||||||
var component = Math.round((1 - this.gray) * 255) + ',';
|
var component = Math.round((1 - this.gray) * 255) + ',';
|
||||||
this._cssString = 'rgba('
|
this._cssString = 'rgba('
|
||||||
+ component + component + component
|
+ component + component + component
|
||||||
+ ((this.alpha != -1) ? this.alpha : 1)
|
+ (this.alpha != -1 ? this.alpha : 1)
|
||||||
+ ')';
|
+ ')';
|
||||||
}
|
}
|
||||||
return this._cssString;
|
return this._cssString;
|
||||||
|
|
|
@ -57,7 +57,8 @@ var RGBColor = Color.extend(new function() {
|
||||||
if (hex.length >= 4) {
|
if (hex.length >= 4) {
|
||||||
var rgb = [];
|
var rgb = [];
|
||||||
for (var i = 1; i < 4; i++)
|
for (var i = 1; i < 4; i++)
|
||||||
rgb.push((hex[i].length == 1 ? hex[i] + hex[i] : hex[i]).toInt(16) / 255);
|
rgb.push((hex[i].length == 1
|
||||||
|
? hex[i] + hex[i] : hex[i]).toInt(16) / 255);
|
||||||
return rgb;
|
return rgb;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -85,7 +86,7 @@ var RGBColor = Color.extend(new function() {
|
||||||
this._red = arg[0];
|
this._red = arg[0];
|
||||||
this._green = arg[1];
|
this._green = arg[1];
|
||||||
this._blue = arg[2];
|
this._blue = arg[2];
|
||||||
this.alpha = (arg.length > 3) ? arg[3] : -1;
|
this.alpha = arg.length > 3 ? arg[3] : -1;
|
||||||
} else if (arg.red !== undefined) {
|
} else if (arg.red !== undefined) {
|
||||||
this._red = arg.red;
|
this._red = arg.red;
|
||||||
this._blue = arg.blue;
|
this._blue = arg.blue;
|
||||||
|
@ -99,7 +100,7 @@ var RGBColor = Color.extend(new function() {
|
||||||
this._red = arguments[0];
|
this._red = arguments[0];
|
||||||
this._green = arguments[1];
|
this._green = arguments[1];
|
||||||
this._blue = arguments[2];
|
this._blue = arguments[2];
|
||||||
this.alpha = (arguments.length > 3) ? arguments[3] : -1;
|
this.alpha = arguments.length > 3 ? arguments[3] : -1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ var RGBColor = Color.extend(new function() {
|
||||||
return '{ red: ' + this.red
|
return '{ red: ' + this.red
|
||||||
+ ', green: ' + this.green
|
+ ', green: ' + this.green
|
||||||
+ ', blue: ' + this.blue
|
+ ', blue: ' + this.blue
|
||||||
+ ((this.alpha != -1) ? ', alpha: ' + this.alpha : '')
|
+ (this.alpha != -1 ? ', alpha: ' + this.alpha : '')
|
||||||
+ ' }';
|
+ ' }';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -192,7 +193,7 @@ var RGBColor = Color.extend(new function() {
|
||||||
+ (Math.round(this.red * 255)) + ', '
|
+ (Math.round(this.red * 255)) + ', '
|
||||||
+ (Math.round(this.green * 255)) + ', '
|
+ (Math.round(this.green * 255)) + ', '
|
||||||
+ (Math.round(this.blue * 255)) + ', '
|
+ (Math.round(this.blue * 255)) + ', '
|
||||||
+ ((this.alpha != -1) ? this.alpha : 1)
|
+ (this.alpha != -1 ? this.alpha : 1)
|
||||||
+ ')';
|
+ ')';
|
||||||
}
|
}
|
||||||
return this._cssString;
|
return this._cssString;
|
||||||
|
|
Loading…
Reference in a new issue