This wish is a little crazy.
* SetFadeGradient(*luaindex* _gradientIndex_, *number* _normalX_, *number* _normalY_, *number* _gradientLength_)
All ZOS code uses only horizontal or vertical gradients, i.e. either normalX == 0 or normalY == 0.
I wanted to fade bottom left and right corners, so I did this:
Lua Code:
local extent = self:GetScrollExtents()
local offset = self:GetScrollOffsets()
self:SetFadeGradient(1, 1, -1, zo_clamp(offset, 0, 15))
self:SetFadeGradient(2, -1, -1, zo_clamp(extent - offset, 0, 15))
On the right corner it works well (ZO_HUDFadeSceneFra...)
But not so much on the left corner:
The problem is that gradient #1 always starts from the TOPLEFT corner, and gradient #2 always starts from the BOTTOMRIGHT corner.
SetFadeGradient could set origin based on the direction of the vector:
for gradient #1
Lua Code:
if normalX >= 0 and normalY >= 0 then origin = TOPLEFT
elseif normalX >= 0 and normalY < 0 then origin = BOTTOMLEFT
elseif normalX < 0 and normalY >= 0 then origin = TOPRIGHT
else origin = BOTTOMRIGHT
end
for gradient #2
Lua Code:
if normalX <= 0 and normalY <= 0 then origin = BOTTOMRIGHT
elseif normalX <= 0 and normalY > 0 then origin = TOPRIGHT
elseif normalX > 0 and normalY <= 0 then origin = BOTTOMLEFT
else origin = TOPLEFT
end