perf: hsl

This commit is contained in:
cha0s 2024-08-05 01:41:21 -05:00
parent c1a090688e
commit ecd26f0ddb

View File

@ -67,8 +67,9 @@ export default class Sprite extends Component {
return this.$$hue;
}
set hue(hue) {
this.$$hue = hue;
const [, s, l] = hexToHsl(this.$$tint);
this.tint = hslToHex(hue, s, l);
super.tint = hslToHex(hue, s, l);
}
initialize(values, defaults) {
let {
@ -87,8 +88,9 @@ export default class Sprite extends Component {
return this.$$lightness;
}
set lightness(lightness) {
this.$$lightness = lightness;
const [h, s] = hexToHsl(this.$$tint);
this.tint = hslToHex(h, s, lightness);
super.tint = hslToHex(h, s, lightness);;
}
get rotates() {
if (!this.$$sourceJson.meta) {
@ -106,8 +108,9 @@ export default class Sprite extends Component {
return this.$$saturation;
}
set saturation(saturation) {
this.$$saturation = saturation;
const [h, , l] = hexToHsl(this.$$tint);
this.tint = hslToHex(h, saturation, l);
super.tint = hslToHex(h, saturation, l);
}
get scale() {
return this.$$scale;