Hi all,
I feel like I must be missing something basic, because I can’t seem to do an equals check on two colors. As to what I’ve been testing:
console.log(pc.app.root.findByName("ClientCharacter" + i + "Border").element.color);
console.log(Lib.Black); //Lib.Black is set as: Lib.Black = new pc.Color(0, 0, 0, 1);
console.log(pc.app.root.findByName("ClientCharacter" + i + "Border").element.color === Lib.Black);
console.log(pc.app.root.findByName("ClientCharacter" + i + "Border").element.color == Lib.Black);
let color1 = new pc.Color(1, 1, 1, 1);
let color2 = new pc.Color(1, 1, 1, 1);
console.log(color1 === color2);
console.log(color1.equals(color2));
The results of the previous code snippets is:
Color {r: 0, g: 0, b: 0, a: 1}
Color {r: 0, g: 0, b: 0, a: 1}
false
false
false
Uncaught TypeError: color1.equals is not a function
The last error is somewhat confusing, as the documentation has dst.equals(src)
as a valid function.
Either way, if ==
isn’t working, ===
isn’t working, and equals()
isn’t a method, is there a simple way of comparing colors, outside of checking r === r, g === g, etc?