Download
(991 b)
Download
Updated: 12-12-10 03:08 PM
Addon for:
oUF.
Updated:12-12-10 03:08 PM
Created:11-01-08 04:19 AM
Downloads:27,126
Favorites:134
MD5:

oUF Smooth Update  Popular! (More than 5000 hits)

Version: 1.4a
by: Xuerian [More]

Smoothly animates status bars on oUF frames.

You can smooth bars in various ways:

  • frame.Health.Smooth = true
  • frame.Power.Smooth = true
  • frame:SmoothBar(frame.Health)
  • frame:SmoothBar(frame.Power)
  • frame:SmoothBar(any other statusbar)

1.4a
Removed debugging

1.4
Updated TOC
No longer smooths changes between status bars with different maximum values
(Most obvious on target changes)

1.3
Fixed namespace acquisition

1.2
Applied fixes in comments. Partly untested.


1.1
Updated API
(frame.Smooth(Power|Health) to frame.(Health|Power).Smooth)
Added :SmoothBar(bar) method to frame for non-standard bars.
Post A Reply Comment Options
Unread 11-01-08, 04:59 AM  
Caellian
A Frostmaul Preserver
 
Caellian's Avatar

Forum posts: 281
File comments: 252
Uploads: 5
Absolutely lovely, thanks for that

I might have spotted a bug though (or not) on my other computer, the character was in a party, one of the party member's health bar was crossing the entire screen from left to right (the unitframe being top left)
A reloadui fixed it, so far.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
Last edited by Caellian : 11-01-08 at 06:19 AM.
Report comment to moderator  
Reply With Quote
Unread 11-01-08, 01:50 PM  
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1710
File comments: 1222
Uploads: 43
Could you please make it work like this instead of what it is right now?
Code:
<object>.Health.Smooth = true
Code:
<object>.Power.Smooth = true
Would be much appreciated
Report comment to moderator  
Reply With Quote
Unread 11-01-08, 02:18 PM  
Xuerian
A Fallenroot Satyr
 
Xuerian's Avatar
AddOn Author - Click to view AddOns

Forum posts: 27
File comments: 161
Uploads: 7
I've changed the API to p3lim's suggestion, and added a frame:SmoothBar(bar) method to support any other bars. The sanity check is also a little more generous, hopefully avoiding any infinite bars.
Last edited by Xuerian : 11-01-08 at 02:18 PM.
Report comment to moderator  
Reply With Quote
Unread 11-01-08, 04:11 PM  
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1710
File comments: 1222
Uploads: 43
Originally posted by Xuerian
I've changed the API to p3lim's suggestion, and added a frame:SmoothBar(bar) method to support any other bars. The sanity check is also a little more generous, hopefully avoiding any infinite bars.
Thank you
Report comment to moderator  
Reply With Quote
Unread 11-04-08, 12:25 PM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1740
File comments: 3728
Uploads: 77
Tested your mod and the feeling was not very smooth. I tested around abit and found that changing this

Code:
local new = cur + min((value-cur)/3, max(value-cur, limit))
to
Code:
local new = cur + min((value-cur)/30, max(value-cur, limit))
finally gave me the smooth feeling I was looking for. Hmmm...
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Last edited by zork : 11-04-08 at 12:41 PM.
Report comment to moderator  
Reply With Quote
Unread 11-04-08, 12:36 PM  
Xuerian
A Fallenroot Satyr
 
Xuerian's Avatar
AddOn Author - Click to view AddOns

Forum posts: 27
File comments: 161
Uploads: 7
Originally posted by zork
Tested your mod and the feeling was not very smooth. I tested around abit and found that changing this

Code:
local new = cur + min((value-cur)/3, max(value-cur, limit))
to
Code:
local new = cur + min((value-cur)/30, max(value-cur, limit))
finally gave me the smooth feeling I was looking for. Hmmm...
That's the simple way to change how smooth you want it to be, seeing as that's current + difference/30 instead of 3... it'll be 10 times slower.

My goal was just to make it slide smoothly instead of jumping around, so if you like it at a different setting, it'll work just fine. I don't see myself making any changes to this any time soon as it's such a simple plugin.
Report comment to moderator  
Reply With Quote
Unread 11-04-08, 12:43 PM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1740
File comments: 3728
Uploads: 77
It worked perfectly for the statusbars but I have problems with my orbs. My orbs need to be sized by SetTexCoord this is due to a bug of SetStatusbar = Vertical and round texture files.

My texture is called "self.Health.Filling" or "self.Power.Filling" maybe you could add another option for Healthbars that are made out of textures.

Thats what worked out for me:

Code:
local f, min, max = CreateFrame("Frame"), math.min, math.max
f:SetScript("OnUpdate", function()
  local limit = 30/GetFramerate()
  for bar, value in pairs(smoothing) do
    local cur = bar:GetValue()
    local barmin, barmax = bar:GetMinMaxValues()
    local new = cur + min((value-cur)/30, max(value-cur, limit))
    bar:SetValue_(new)
    if bar.Filling then
      bar.Filling:SetHeight((new / barmax) * bar:GetWidth())
      bar.Filling:SetTexCoord(0,1,  math.abs(new / barmax - 1),1)
    end
    if cur == value or abs(cur - value) < 2 then
      smoothing[bar] = nil
    end
  end
end)
Looks awesome now. Thanks alot.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Last edited by zork : 11-04-08 at 12:49 PM.
Report comment to moderator  
Reply With Quote
Unread 11-04-08, 07:09 PM  
Xuerian
A Fallenroot Satyr
 
Xuerian's Avatar
AddOn Author - Click to view AddOns

Forum posts: 27
File comments: 161
Uploads: 7
I'd suggest you just fold this in your frames as it seems to be a isolated case, and this code is fairly simple. Ignore the hooking part and apply it yourself, as it'd also let you specify the amount to smooth.

If other orb-based frames exist and use the same standard method, I could support that.

Originally posted by zork
It worked perfectly for the statusbars but I have problems with my orbs. My orbs need to be sized by SetTexCoord this is due to a bug of SetStatusbar = Vertical and round texture files.

My texture is called "self.Health.Filling" or "self.Power.Filling" maybe you could add another option for Healthbars that are made out of textures.

Thats what worked out for me:

Code:
local f, min, max = CreateFrame("Frame"), math.min, math.max
f:SetScript("OnUpdate", function()
  local limit = 30/GetFramerate()
  for bar, value in pairs(smoothing) do
    local cur = bar:GetValue()
    local barmin, barmax = bar:GetMinMaxValues()
    local new = cur + min((value-cur)/30, max(value-cur, limit))
    bar:SetValue_(new)
    if bar.Filling then
      bar.Filling:SetHeight((new / barmax) * bar:GetWidth())
      bar.Filling:SetTexCoord(0,1,  math.abs(new / barmax - 1),1)
    end
    if cur == value or abs(cur - value) < 2 then
      smoothing[bar] = nil
    end
  end
end)
Looks awesome now. Thanks alot.
Last edited by Xuerian : 11-04-08 at 07:15 PM.
Report comment to moderator  
Reply With Quote
Unread 11-08-08, 10:31 PM  
Caellian
A Frostmaul Preserver
 
Caellian's Avatar

Forum posts: 281
File comments: 252
Uploads: 5
Originally posted by Caellian
Absolutely lovely, thanks for that

I might have spotted a bug though (or not) on my other computer, the character was in a party, one of the party member's health bar was crossing the entire screen from left to right (the unitframe being top left)
A reloadui fixed it, so far.
It has happened again, despite the change you've made, a simple reloadui fix it though.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
Report comment to moderator  
Reply With Quote
Unread 11-10-08, 01:52 PM  
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1710
File comments: 1222
Uploads: 43
.SmoothBar() doesnt work
Report comment to moderator  
Reply With Quote
Unread 11-14-08, 03:56 AM  
Xuerian
A Fallenroot Satyr
 
Xuerian's Avatar
AddOn Author - Click to view AddOns

Forum posts: 27
File comments: 161
Uploads: 7
Originally posted by p3lim
.SmoothBar() doesnt work
Which is why you call :SmoothBar.
Report comment to moderator  
Reply With Quote
Unread 01-07-09, 06:16 AM  
hipjipp
A Cliff Giant
 
hipjipp's Avatar
AddOn Author - Click to view AddOns

Forum posts: 79
File comments: 236
Uploads: 10
I've been noticing a small "bug" or perhaps a slight glitch.. When creating a new character or getting onto a low-leveled one, the bar isn't filled completely... There's about 5-10 pixels missing on the bar when it's "full". Could this be fixed with anything or am i stuck with it? It disappears after a certain hp-limit, but i havn't payed to close attention to it to say when the limit is reached.
Report comment to moderator  
Reply With Quote
Unread 02-09-09, 08:19 PM  
Toran
A Nerdscale Dorkin
 
Toran's Avatar
Premium Member

Forum posts: 143
File comments: 433
Uploads: 0
Originally posted by hipjipp
I've been noticing a small "bug" or perhaps a slight glitch.. When creating a new character or getting onto a low-leveled one, the bar isn't filled completely... There's about 5-10 pixels missing on the bar when it's "full". Could this be fixed with anything or am i stuck with it? It disappears after a certain hp-limit, but i havn't payed to close attention to it to say when the limit is reached.
Any thoughts on how to fix this? I notice the same thing on my low lvl bank toon (shaman orc). Didn't notice on my lvl 26 Priest Undead. Haven't checked my others yet.

Edit: Happens on my lvl 70 Rogue also, but only on the energy bar - last few pixels missing. Seems to be fixed on a reload in his case.
Last edited by Toran : 02-18-09 at 09:02 PM.
Report comment to moderator  
Reply With Quote
Unread 04-08-09, 12:19 PM  
Gotai
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 5
File comments: 26
Uploads: 8
Fix for bars not filling completely.

Here's a fix for the bars not filling completely. Replace lines 39-41 with:

Code:
		if cur == value or abs(cur - value) < 2 then
			bar:SetValue_(value)
			smoothing[bar] = nil
		end
We're currently working out the cause of the bars crossing the entire screen. Should have a fix for that shortly.

Edit: Thanks to diligent testing by Caellian, I'm fairly sure this should patch the problem for good: http://pastey.net/111986

For the interested few, GetValue() returns wonky values before the first SetValue. One of the possible returns is a QNAN value, which was causing the problem.
Last edited by Gotai : 04-09-09 at 06:16 AM.
Report comment to moderator  
Reply With Quote
Unread 04-21-09, 04:54 PM  
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view AddOns

Forum posts: 5617
File comments: 2321
Uploads: 54
Thank you, Gotai!
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: