Lines gradient on a trapezoid surface

I would like to do this pattern on a trapezoid shape. It is too complicated to me what I want to do, it is above my skills. Basically I would like to do a line gradient where are group of lines , but in each one there plus one more line. There is also two options for ending for the gradient, a) is goes totally black, or b) it is just continues with lines with the same gap as it was in the groups. I would like to have the line thickness changeable and also the gaps between the groups. The lines should follow the UVs of any surface I put the script on. Currently I would like to use it on a trapezoid shape.