Skip to content

Instantly share code, notes, and snippets.

@unstoppablecarl
Created March 4, 2013 02:29
Show Gist options
  • Save unstoppablecarl/5079491 to your computer and use it in GitHub Desktop.
Save unstoppablecarl/5079491 to your computer and use it in GitHub Desktop.
var delta = this.lifeSpanTimer.delta();
color.r = Math.floor(delta.map(0, 1, this.startColor.r, this.endColor.r ));
color.g = Math.floor(delta.map(0, 1, this.startColor.g, this.endColor.g ));
color.b = Math.floor(delta.map(0, 1, this.startColor.b, this.endColor.b ));
color.a = Math.floor(delta.map(0, 1, this.startColor.a, this.endColor.a ));
ctx.fillStyle = 'rgba(' + color.r + ',' + color.g + ',' + color.b + ',' + color.a + ')';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment