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

Interpolate.ColorWithColor always returns a ColorObject with an undefined color value #6979

Closed
XWILKINX opened this issue Dec 10, 2024 · 1 comment
Assignees

Comments

@XWILKINX
Copy link

Version

  • Phaser Version: 3.87
  • Operating system: Windows 10
  • Browser: Chrome

Description

When using Phaser.Display.Color.Interpolate.ColorWithColor, the resulting ColorObject always has an undefined color value.

Example Test Code

let interpValue = 0.5;
const colorA = Phaser.Display.Color.IntegerToColor(0x000000); //Black
const colorB = Phaser.Display.Color.IntegerToColor(0xFFFFFF); //White
console.log(Phaser.Display.Color.Interpolate.ColorWithColor(colorA, colorB, 1, interpValue).color); //Always undefined

Additional Information

Current workaround is to use an additional Phaser.Display.Color.GetColor call:

let interpValue = 0.5;
const colorA = Phaser.Display.Color.IntegerToColor(0x000000);
const colorB = Phaser.Display.Color.IntegerToColor(0xFFFFFF);
const c = Phaser.Display.Color.Interpolate.ColorWithColor(colorA, colorB, 1, interpValue);
console.log(Phaser.Display.Color.GetColor(c.r, c.g, c.b)); //Expected result
@zekeatchan
Copy link
Collaborator

Hi @XWILKINX. Thanks for submitting this issue. We have fixed this and pushed it to the master branch. It will be part of the next release. Do test it out and let us know if you encounter any issues.

@zekeatchan zekeatchan self-assigned this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants