Download
(991 b)
Download
Updated: 12-12-10 02:08 PM
Addon for:
oUF.
Updated:12-12-10 02:08 PM
Created:11-01-08 04:19 AM
Downloads:22,232
Favorites:139
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.
Archived Files (3)
File Name
Version
Size
Author
Date
1.3
1kB
Xuerian
01-12-10 03:13 PM
1.2
1kB
Xuerian
01-12-10 12:28 AM
1.1
959B
Xuerian
11-01-08 02:16 PM


Post A Reply Comment Options
Old 01-07-09, 05:16 AM  
hipjipp
A Cliff Giant
 
hipjipp's Avatar
AddOn Author - Click to view AddOns

Forum posts: 79
File comments: 229
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.
__________________
Being boring is fine too.
hipjipp is offline Report comment to moderator  
Reply With Quote
Old 11-14-08, 02:56 AM  
Xuerian
A Fallenroot Satyr
 
Xuerian's Avatar
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 157
Uploads: 9
Originally posted by p3lim
.SmoothBar() doesnt work
Which is why you call :SmoothBar.
Xuerian is offline Report comment to moderator  
Reply With Quote
Old 11-10-08, 12:52 PM  
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1174
File comments: 1205
Uploads: 24
.SmoothBar() doesnt work
p3lim is offline Report comment to moderator  
Reply With Quote
Old 11-08-08, 09:31 PM  
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
AddOn Author - Click to view AddOns

Forum posts: 268
File comments: 942
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'); }
Caellian is offline Report comment to moderator  
Reply With Quote
Old 11-04-08, 06:09 PM  
Xuerian
A Fallenroot Satyr
 
Xuerian's Avatar
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 157
Uploads: 9
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 06:15 PM.
Xuerian is offline Report comment to moderator  
Reply With Quote
Old 11-04-08, 11:43 AM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1308
File comments: 3288
Uploads: 84
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.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

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

Forum posts: 24
File comments: 157
Uploads: 9
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.
Xuerian is offline Report comment to moderator  
Reply With Quote
Old 11-04-08, 11:25 AM  
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1308
File comments: 3288
Uploads: 84
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.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
Last edited by zork : 11-04-08 at 11:41 AM.
zork is online now Report comment to moderator  
Reply With Quote
Old 11-01-08, 04:11 PM  
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1174
File comments: 1205
Uploads: 24
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
p3lim is offline Report comment to moderator  
Reply With Quote
Old 11-01-08, 02:18 PM  
Xuerian
A Fallenroot Satyr
 
Xuerian's Avatar
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 157
Uploads: 9
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.
Xuerian is offline Report comment to moderator  
Reply With Quote
Old 11-01-08, 01:50 PM  
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1174
File comments: 1205
Uploads: 24
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
p3lim is offline Report comment to moderator  
Reply With Quote
Old 11-01-08, 04:59 AM  
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
AddOn Author - Click to view AddOns

Forum posts: 268
File comments: 942
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.
Caellian is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: