ฉันพยายามจะทำให้เรียบง่ายอร์สิ่งแฟลชสีเขียว,สีฟ้าและสีแดงจากพื้นฐานเงื่อนไขที่แตกต่างกัน. ฉันเข้าใจว่ามันไม่มีตรงทางที่จะเปลี่ยนสีของกราฟิกวัตถุอยู่ใน PixiJS. ตอนนี้ฉันสร้างสามกราฟิกวัตถุงซึ่งเป็นเหมือนกันยกเว้นสำหรับ,ให้พิมพ์สี. โดยนั้นมันซ้อนกันพวกวัตถุและปรับตัวกับเรื่องที่มองเห็นได้,ฉันสามารถที่จะให้สำเร็จที่ฉันคิดแบบมีภาพเคลื่อนไหว.
ฉันสงสัยว่าถ้านั่นคือทางที่ดีกว่า"จะเปลี่ยนแปลง"การพิมพ์สีแทนที่จะโกงมันกับมองเห็นได้.
ของปัจจุบันรหัส:
let square_red = new PIXI.Graphics();
square.beginFill(red, opacity);
square.lineStyle(lineStyle);
square.drawRect(0, 0, width, height);
square.position.set(x, y);
let square_green = new PIXI.Graphics();
square.beginFill(green, opacity);
square.lineStyle(lineStyle);
square.drawRect(0, 0, width, height);
square.position.set(x, y);
let square_blue = new PIXI.Graphics();
square.beginFill(blue, opacity);
square.lineStyle(lineStyle);
square.drawRect(0, 0, width, height);
square.position.set(x, y);
square_red.visible = true;
square_green.visible = false;
square_blue.visible = false;