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