View Single Post
10-03-16, 08:33 AM   #6
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Here's a small demo:

Lua Code:
  1. local frame = CreateFrame("Frame")
  2. local textsToAnimate = {}
  3.  
  4. local function OnUpdate(self, elapsed)
  5.     for _, text in pairs(textsToAnimate) do
  6.         text:UpdateAnimatedValue(elapsed)
  7.     end
  8. end
  9.  
  10. frame:SetScript("OnUpdate", OnUpdate)
  11.  
  12. frame:SetScript("OnEvent", function()
  13.     local text = UIParent:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
  14.     text:SetPoint("CENTER", -128, 64)
  15.     Mixin(text, AnimatedNumericFontStringMixin)
  16.     table.insert(textsToAnimate, text)
  17.  
  18.     text = UIParent:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
  19.     text:SetPoint("CENTER", -128, 32)
  20.     Mixin(text, AnimatedNumericFontStringMixin)
  21.     table.insert(textsToAnimate, text)
  22.  
  23.     text = UIParent:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
  24.     text:SetPoint("CENTER", -128, 0)
  25.     Mixin(text, AnimatedNumericFontStringMixin)
  26.     table.insert(textsToAnimate, text)
  27.  
  28.     text = UIParent:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
  29.     text:SetPoint("CENTER", -128, -32)
  30.     Mixin(text, AnimatedNumericFontStringMixin)
  31.     table.insert(textsToAnimate, text)
  32.  
  33.     C_Timer.NewTicker(2, function()
  34.         for _, text in pairs(textsToAnimate) do
  35.             text:SetAnimatedValue(math.random(10, 10000))
  36.         end
  37.     end)
  38. end)
  39.  
  40. frame:RegisterEvent("PLAYER_LOGIN")
__________________
  Reply With Quote