Skip to content

Commit

Permalink
Fixed #6979. Interpolate.ColorWithColor returns all ColorObject pro…
Browse files Browse the repository at this point in the history
…perties
  • Loading branch information
zekeatchan committed Jan 6, 2025
1 parent e6d9908 commit 8878a11
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/display/color/Interpolate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

var Linear = require('../../math/Linear');
var GetColor = require('./GetColor');

/**
* @namespace Phaser.Display.Color.Interpolate
Expand Down Expand Up @@ -37,11 +38,16 @@ var RGBWithRGB = function (r1, g1, b1, r2, g2, b2, length, index)
if (index === undefined) { index = 0; }

var t = index / length;
var r = Linear(r1, r2, t);
var g = Linear(g1, g2, t);
var b = Linear(b1, b2, t);

return {
r: Linear(r1, r2, t),
g: Linear(g1, g2, t),
b: Linear(b1, b2, t)
r: r,
g: g,
b: b,
a: 255,
color: GetColor(r, g, b)
};
};

Expand Down

0 comments on commit 8878a11

Please sign in to comment.