mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +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;
|
||||
}
|
||||
|
||||
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 {
|
||||
return new Color().setFromString(hex);
|
||||
}
|
||||
|
||||
@ -432,6 +432,13 @@ export class Spine extends Container {
|
||||
Spine.skeletonCache[cacheKey] = skeletonData;
|
||||
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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user