change color swapping to be more concise

This commit is contained in:
Triplelexx 2017-03-11 07:40:32 +00:00
parent 8a0dd55275
commit 873a9aa39e

View file

@ -79,15 +79,11 @@
} else { } else {
// after tween completion reset to zero and flip values to ping pong // after tween completion reset to zero and flip values to ping pong
tweenPosition = 0; tweenPosition = 0;
var buf = startColor.red; for (var color in startColor) {
startColor.red = endColor.red; var storedColor = startColor[color];
endColor.red = buf; startColor[color] = endColor[color];
buf = startColor.green; endColor[color] = storedColor;
startColor.green = endColor.green; }
endColor.green = buf;
buf = startColor.blue;
startColor.blue = endColor.blue;
endColor.blue = buf;
} }
// update position based on LERP_AMOUNT // update position based on LERP_AMOUNT