Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change utils.rgb2hex to Color.shared.setValue #536

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"@pixi/graphics": "^7.0.0",
"@pixi/mesh": "^7.0.0",
"@pixi/mesh-extras": "^7.0.0",
"@pixi/sprite": "^7.0.0"
"@pixi/sprite": "^7.0.0",
"@pixi/color": "^7.0.0"
},
"scripts": {
"build": "run-p build:*",
Expand Down
7 changes: 4 additions & 3 deletions packages/base/src/SpineBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SimpleMesh } from '@pixi/mesh-extras';
import { Graphics } from '@pixi/graphics';
import { settings } from './settings';
import type { ISpineDebugRenderer } from './SpineDebugRenderer';
import { Color } from '@pixi/color';

const tempRgb = [0, 0, 0];

Expand Down Expand Up @@ -200,7 +201,7 @@ export abstract class SpineBase<
* @default 0xFFFFFF
*/
get tint(): number {
return utils.rgb2hex(this.tintRgb as any);
return Color.shared.setValue(Array.from(this.tintRgb)).toNumber();
}

set tint(value: number) {
Expand Down Expand Up @@ -325,7 +326,7 @@ export abstract class SpineBase<
tempRgb[0] = light[0] * slot.color.r * attColor.r;
tempRgb[1] = light[1] * slot.color.g * attColor.g;
tempRgb[2] = light[2] * slot.color.b * attColor.b;
slot.currentSprite.tint = utils.rgb2hex(tempRgb);
slot.currentSprite.tint = Color.shared.setValue(tempRgb).toNumber();
}
slot.currentSprite.blendMode = slot.blendMode;
break;
Expand Down Expand Up @@ -383,7 +384,7 @@ export abstract class SpineBase<
tempRgb[0] = light[0] * slot.color.r * attColor.r;
tempRgb[1] = light[1] * slot.color.g * attColor.g;
tempRgb[2] = light[2] * slot.color.b * attColor.b;
slot.currentMesh.tint = utils.rgb2hex(tempRgb);
slot.currentMesh.tint = Color.shared.setValue(tempRgb).toNumber();
}
slot.currentMesh.blendMode = slot.blendMode;
if (!slot.hackRegion) {
Expand Down