mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts][pixi] Add tint property for Pixi's convention.
This commit is contained in:
parent
0e13cdbb76
commit
89831677e4
@ -171,6 +171,13 @@ export class Color {
|
|||||||
color.b = ((value & 0x000000ff)) / 255;
|
color.b = ((value & 0x000000ff)) / 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toRgb888 () {
|
||||||
|
function hex(x: number) {
|
||||||
|
return ("0" + (x * 255).toString(16)).slice(-2);
|
||||||
|
}
|
||||||
|
return Number("0x" + hex(this.r) + hex(this.g) + hex(this.b));
|
||||||
|
}
|
||||||
|
|
||||||
static fromString (hex: string): Color {
|
static fromString (hex: string): Color {
|
||||||
return new Color().setFromString(hex);
|
return new Color().setFromString(hex);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -432,6 +432,13 @@ export class Spine extends Container {
|
|||||||
Spine.skeletonCache[cacheKey] = skeletonData;
|
Spine.skeletonCache[cacheKey] = skeletonData;
|
||||||
return new this(skeletonData, options);
|
return new this(skeletonData, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get tint (): number {
|
||||||
|
return this.skeleton.color.toRgb888();
|
||||||
|
}
|
||||||
|
public set tint (value: number) {
|
||||||
|
Color.rgb888ToColor(this.skeleton.color, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Skeleton.yDown = true;
|
Skeleton.yDown = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user