View Single Post
03-01-22, 09:50 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
When expiring buffs flash, Blizzard doesn't use any animation functions, they just change the alpha every frame. Here's the complete math behind it if you want to try matching it with animations or just use it:

Lua Code:
  1. function BuffFrame_OnUpdate(self, elapsed)
  2.     if ( self.BuffFrameUpdateTime > 0 ) then
  3.         self.BuffFrameUpdateTime = self.BuffFrameUpdateTime - elapsed
  4.     else
  5.         self.BuffFrameUpdateTime = self.BuffFrameUpdateTime + 0.2
  6.     end
  7.  
  8.     self.BuffFrameFlashTime = self.BuffFrameFlashTime - elapsed
  9.     if ( self.BuffFrameFlashTime < 0 ) then
  10.         local overtime = -self.BuffFrameFlashTime
  11.         if ( self.BuffFrameFlashState == 0 ) then
  12.             self.BuffFrameFlashState = 1
  13.             self.BuffFrameFlashTime = 0.75
  14.         else
  15.             self.BuffFrameFlashState = 0
  16.             self.BuffFrameFlashTime = 0.75
  17.         end
  18.         if ( overtime < self.BuffFrameFlashTime ) then
  19.             self.BuffFrameFlashTime = self.BuffFrameFlashTime - overtime
  20.         end
  21.     end
  22.  
  23.     if ( self.BuffFrameFlashState == 1 ) then
  24.         self.BuffAlphaValue = (0.75 - self.BuffFrameFlashTime) / 0.75
  25.     else
  26.         self.BuffAlphaValue = self.BuffFrameFlashTime / 0.75
  27.     end
  28.     self.BuffAlphaValue = (self.BuffAlphaValue * (1 - 0.3)) + 0.3
  29. end

Then they use AuraButton#:SetAlpha(BuffFrame.BuffAlphaValue) in the individual OnUpdate functions for each icon if timeLeft < 31 seconds, which means all expiring buffs pulse in sync with each other.

Last edited by Kanegasi : 03-01-22 at 09:53 PM.
  Reply With Quote