Jump to content

Best method to decrease/Increase bitmap rgb values over time/space


Recommended Posts



I'd like to change color values of bitmap gradients over time or based on player's position (e.g. a torch is becoming redder over time or brighter the deeper we go).


The code below of course doesn't work, but I'ma at loss in which direction looking for.

var fade = Math.round(this.player.y / 10, 0);maskGradient.addColorStop(0, 'rgb( 255 - fade, 255 - fade, 255 - fade)'); maskGradient.addColorStop(1, 'rgb(50 - fade, 50 - fade, 50 - fade)');

What would be the best approach?



Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...