PixiJS อะไรคือหนทางที่ดีที่สุดที่จะเปลี่ยนเป็นกราฟิกวัตถุนสี?

0

คำถาม

ฉันพยายามจะทำให้เรียบง่ายอร์สิ่งแฟลชสีเขียว,สีฟ้าและสีแดงจากพื้นฐานเงื่อนไขที่แตกต่างกัน. ฉันเข้าใจว่ามันไม่มีตรงทางที่จะเปลี่ยนสีของกราฟิกวัตถุอยู่ใน 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;
javascript pixi.js
2021-11-22 06:59:45
1

คำตอบที่ดีที่สุด

0

คุณสามารถสร้างเป็นวงกลมสีขาวและเปลี่ยนผสมสีของมัน

const circle = new PIXI.Graphics();
circle.beginFill(0xffffff);
circle.drawCircle(0, 0, 100);
circle.endFill();

circle.tint = 0xff0000;
2021-11-23 14:38:42

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังคำถามอยู่ในนี้หมวดหมู่