Forgive me as I am a programmer, not a mathematician.
I have a rectangular plane that I am drawing shapes onto, I want to create an effect where coloured shapes traveling to the outer edges of this rectangle become more and more faded in an oblong pattern where the sides of the rectangle are a tangent to the furthest points of the oblong in its respective X/Y directions, when the points are outside the bounds of the oblong they will be completely invisible, when they are dead in the center they will be 100% visible, when they are half way between the boundary of the oblong and the center they will be at 50% transparency. To achieve this I initially calculated the distance of the point to the center of the rectangle and divided that by the width of the rectangle to get a ratio of how far from the center of the rectangle my point is relative to the width, and use the output as the opacity for the shapes I draw at the points. This approach obviously only works in perfect circles and when the rectangles width is less than its height.
The solution I can think of is some equation where it creates a elongated hemisphere that's max Z value is 1, and its center (peak?) = the center of the rectangle and its sides are elongated to meet the edges of the rectangle & it should then return a Z coordinate for any given X/Y coordinate within my rectangular plane, which should be a figure between 0-1 I can use for the opacity, if my idea is at all plausible.
I did some looking into it and someone had explained this, a sphere with center (x0, y0, z0) and radius r is the locus of all points (x, y, z) such that (x - x0 )^2 + (y - y0 )^2 + ( z - z0 )^2 = r^2 which seems to almost fit what I am looking for, but i do not know how to manipulate the sphere to elongate its sides to match the width/height of my rectangle. As i said, I am a programmer not a mathematician and all of this is baseless theory I have pulled out of thin air whilst trying to solve my problem, apologies if my terminology is a world off and my ideas are half baked at best, any help and/or direction would be appreciated.