Skip to content

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

Closed
@XWILKINX

Description

@XWILKINX

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions