You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Nice! For the disc, you could try something like:

      let yOffset = -Radius;
      setTimeout(function cb() {
        for (let xOffset = -Radius; xOffset <= Radius; xOffset++) {
          let OffsetSquared = xOffset*xOffset + yOffset*yOffset;
          if (OffsetSquared <= RadiusSquared) {
            let Hue        = Rad2Deg(Math.atan2(yOffset,xOffset));
            let Saturation = Math.sqrt(OffsetSquared)/Radius;
            let RGB        = HSVtoRGB(Hue, Saturation, Value);
            let Color = RGB[0] << 11 | RGB[1] << 5 | RGB[2];
            g.setPixel(Radius+xOffset,Radius+yOffset­, Color);
          }
        }
        yOffset++;
        if (yOffset <= Radius)
          setTimeout(cb,10);
      },10);
    

    To ensure that it doesn't 'hang' the browser while computing it :)

About

Avatar for Gordon @Gordon started