code: public static float getAlphaForOffset(float alphaStart, float alphaEnd,
                                            float posStart, float posEnd, float posOffset) {
          return alphaStart + posOffset * (alphaEnd - alphaStart) / (posEnd - posStart);
      }
docs: Calculate the alpha value for a position offset.
  
  @param alphaStart
  @param alphaEnd
  @param posStart
  @param posEnd
  @param posOffset