Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
fix alpha animation
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodBoyDigital committed Mar 22, 2024
1 parent 600a4c7 commit 9ae81aa
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/BatchableSpineSlot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,32 @@ export class BatchableSpineSlot implements BatchableObject

const vertexSize = this.vertexSize;

const abgr = this.renderable.groupColorAlpha;
const parentColor:number = this.renderable.groupColor; // BGR
const parentAlpha:number = this.renderable.groupAlpha;

const slotColor: {r: number, g:number, b: number, a: number} = slot.color;

let abgr:number;

const mixedA = (slotColor.a * parentAlpha) * 255;

if (parentColor !== 0xFFFFFF)
{
const parentB = (parentColor >> 16) & 0xFF;
const parentG = (parentColor >> 8) & 0xFF;
const parentR = parentColor & 0xFF;

const mixedR = (slotColor.r * parentR) * 255;
const mixedG = (slotColor.g * parentG) * 255;
const mixedB = (slotColor.b * parentB) * 255;

abgr = ((mixedA) << 24) | (mixedB << 16) | (mixedG << 8) | mixedR;
}
else
{
abgr = ((mixedA) << 24) | ((slotColor.b * 255) << 16) | ((slotColor.g * 255) << 8) | (slotColor.r * 255);
}

const uvs = attachment.uvs;

const matrix = this.renderable.groupTransform;
Expand Down

0 comments on commit 9ae81aa

Please sign in to comment.