Originally Posted by semlar
You'll have to apply your matrix transformation before calculating the rotated texture coordinates, that way you're rotating the transformed version of the image.
This requires knowing the matrix that was used to calculate your original texture coordinates, not the texture coordinates themselves.
|
I simply pre-stored the texCoords for the animation in a table and used OnUpdate() function to cycle through them...
Lua Code:
local texCoords = {
[ 1] = { 0.00, 0.25, 0.00, 0.0625 },
[ 2] = { 0.25, 0.50, 0.00, 0.0625 },
[ 3] = { 0.50, 0.75, 0.00, 0.0625 },
[ 4] = { 0.75, 1.00, 0.00, 0.0625 },
[ 5] = { 0.00, 0.25, 0.0625, 0.1250 },
...
}
function AnimationUpdateFrame_OnUpdate(self,elapsed)
update = update + elapsed
while update >= interval do
if index >= 60 then
index = 1
else
index = index + 1
end
for _, frame in pairs(framesToAnimate) do
if frame:IsShown() and frame:IsVisible() then
frame.Fill:SetTexCoord(unpack(texCoords[index]))
end
end
update = update - interval
end
end
Failure Testing:
- Green = centered statusBar (adjusted range from 14-86%)
- White = 2 scrollframes (14% value each)
- Red = counter clockwise rotated statusbars inside the scrollframes (-45°)
Also tried to rotate the scrollframe itself and counter rotate the statusbar, but it seems that the scrollframe isn't rotatable.
Edit: btw, used xml for the complete scrollframe stuff (template usage)