Bug Report: Bug in addColorStop for small offsets < 0.1

I tried to make my very own lightscript where I added multiple waves or multiple rainbows because this was the effect I previously had on RGBFusion and I liked it.

The problem is if you add too many addColorStops with very small fractions of offsets like 0.05 or even smaller then somehow effect in SignalRGB start shrinking even if there was a final addColorStop with ‘1’ offset.

Here’s the lightscript which demonstrates the issue:

    <title>Multi Wave</title>
    <meta description="Rainbow Effect with multiple waves"/>
    <meta publisher="Marc Elser" />
    <meta property="speed" label="Cycle Speed" type="number" min="1" max="10" default="2">
    <meta property="waves" label="Waves" type="number" min="1" max="5" default="2">
<body style="margin: 0; padding: 0;">
  	<canvas id="exCanvas" width="320" height="200"></canvas>
    var c = document.getElementById("exCanvas");
    var ctx = c.getContext("2d"); 
    var width = 320;
    var height = 200;
	var colorstops = 10;
  	// Initial hue is set to 0
    var currenthue = 0;

    function update() {
	var totalstops = colorstops * waves;
	var stopwidth = 1 / totalstops;
	var distance = Math.floor(360 / colorstops)
      var grd = ctx.createLinearGradient(0, 0, width, 0);
	  nexthue = currenthue
      currenthue+=(speed / 4);
	  for(i = 0; i <= totalstops; i++) {
	    grd.addColorStop(i * stopwidth,`hsl(${nexthue}, 100%, 50%)`);
		nexthue += distance;
		if (nexthue >= 360) { nexthue = nexthue % 360; }
      ctx.fillStyle = grd;
      ctx.fillRect(0, 0, width , height);




With colorStops set = 10 it works with only 1 wave, so the values for the addColorStop are 0.1, 0.2, 0.3, etc., if you increase the waves to ‘2’ the addColorStop values are 0.05, 0.10, 0.15, etc. but then the effect only fills half the effect window when loaded. And the more waves you create the smaller the filled area in the effect windows gets. If you reduce the colorstep to let’s say 4 you can go up to 3 waves before it starts shortening the effect.

The code above works perfectly if the Engine Would do it’s job. I know this because I quickly embedded this in a HTML file with a canvas and loaded it into chrome. There always the full canvas is drawn no matter how small the colorstep offset gets. Even if I bump it up to 3 waves with 50 gradients each so 150 it still shows it perfectly fine.

I don’t know why the engine does not like addColorStops with offset smaller then 0.1 but please fix this asap.