View Single Post
05-25-16, 07:37 PM   #77
syncrow
A Flamescale Wyrmkin
 
syncrow's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 149
Originally Posted by semlar View Post
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:
  1. local texCoords = {
  2.     [ 1] = { 0.00, 0.25, 0.00, 0.0625 },
  3.     [ 2] = { 0.25, 0.50, 0.00, 0.0625 },
  4.     [ 3] = { 0.50, 0.75, 0.00, 0.0625 },
  5.     [ 4] = { 0.75, 1.00, 0.00, 0.0625 },
  6.     [ 5] = { 0.00, 0.25, 0.0625, 0.1250 },
  7.     ...
  8. }
  9.  
  10. function AnimationUpdateFrame_OnUpdate(self,elapsed)
  11.     update = update + elapsed
  12.    
  13.     while update >= interval do
  14.         if index >= 60 then
  15.             index = 1
  16.         else
  17.             index = index + 1
  18.         end
  19.  
  20.         for _, frame in pairs(framesToAnimate) do
  21.             if frame:IsShown() and frame:IsVisible() then
  22.                 frame.Fill:SetTexCoord(unpack(texCoords[index]))
  23.             end
  24.         end
  25.        
  26.         update = update - interval
  27.     end
  28. 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)
__________________

Last edited by syncrow : 05-25-16 at 08:28 PM.
  Reply With Quote