getColorAt (CANVAS TRICK ROBUST)

A robust version of getColorAt() that uses a canvas trick. We apply the gradient to a hidden canvas and query the pixel color with the canvas.getImageData() function. See here for a basic computational version. See here for a robust computational version. The selected circle is filled with getColorAt(...) on mouse movement. Hold shift to change the highlight location.
  • Allows stops to be in random order
  • Allows for unspecified offsets (notice red and green)
  • Allows a radial highlight (paper gradient) or inner circle (canvas gradient)

Source


No comments:

Post a Comment