Thread Tools Display Modes
08-10-12, 03:18 PM   #1
Copialinex
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 6
Translation animation and screen resolution

Well, I'm updating BalancePowerTracker and I decided to create a nice translation animation (somewhat like a cast bar) instead of having a frame move itself via a throttled OnUpdate handler, and thus leaving all the animation CPU usage to the game.
So I code it that way in a old laptop with 1024x768 resolution and it works fine, nice and shinny.
My surprise is when I get home, I upload my addon to the desktop (brand new 1920x1080) and the moving spark is now free!, unbounded by the awful bar borders (it was never bounded, but it stayed in like a good boy)
I check and recheck... all the calculations are right, the animation offset is what and where it should be, so nearly becoming bald from picking on my own hair, I decide to try again in the old laptop, and it works fine...
You can imagine my hopelessness... so I change the screen resolution settings in my desktop and it works FOUND YA!, and now my problem is that with some resolutions it works fine, and others it flees.

After this story, my question is: Does anybody know the relation between this elements? I tried with screen ratio and screen width, without finding it. Here are my results:
800x600 - fine (animation ends at the end of the bar)
1024x768 - fine (animation ends at the end of the bar)
1152x864 - escapes (the animation ends at ~1.125 * barLength)
1280x600 - fine (animation ends at the end of the bar)
1280x720 - fine (it it falls short, I can't see it)
1280x768 - fine (it it falls short, I can't see it)
1280x800 - escapes (the animation ends at ~1.065 * barLength)
1280x960 - escapes (the animation ends at ~1.166 * barLength)
1280x1024 - escapes (the animation ends at ~1.2 * barLength)
1360x768 - fine (animation ends at the end of the bar)
1366x768 - fine (it it falls short, I can't see it)
1400x1050 - escapes (the animation ends at ~1.25 * barLength)
1440x900 - escapes (the animation ends at ~1.125 * barLength)
1600x900 - escapes (the animation ends at ~1.125 * barLength)
1680x1050 - escapes (the animation ends at ~1.2 * barLength)
1920x1080 - escapes (the animation ends at ~1.25 * barLength)

And the relevant parts of the code:
Lua Code:
  1. local spellCast, _, _, _, startTime, endTime = UnitCastingInfo("player")
  2.     local progress = max((GetTime()*1000 - startTime)/(endTime - startTime),0) --[0,1]
  3.     local duration = (endTime - max(GetTime()*1000,startTime))/1000
  4.     local origin = (-.5 + progress)*width
  5.     local dest = .5*width
  6.     local offset = (dest - origin)
  7.  
  8.     me.spark:ClearAllPoints(); 
  9.     me.spark:SetPoint("CENTER",origin,0)
  10.     me.sparkTranslation:SetOffset(offset,0)
  11.     me.sparkTranslation:SetDuration(duration)
  12.     me.spark:Show()
  13.     me.sparkAnimationGroup:Play()

Thank you!!!
  Reply With Quote
08-11-12, 02:55 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Can you provide a screenshot. This can tell alot.

So you are using this addon?
http://www.wowinterface.com/download...o.php?id=18000

I remember I had a similar resizing problem on nameplates. Default nameplates shrink when you resize the window. You may be able to reproduce your error in windowed mode.

Not sure if it can help you out but check out Blackbox:
http://static.curseforge.net/content..._for_3.1.2.zip

It is the only addon I know that uses translation.

What I can see from your post is that any resolution in "height" > 768 is not working. Maybe that is sth. to start off.

What is in your "width" variable?
__________________
| 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 : 08-11-12 at 02:57 AM.
  Reply With Quote
08-11-12, 04:19 AM   #3
Copialinex
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 6
Uploaded 2 screenshots, one working fine (2nd one 1024 x 768) and one not (1st one 1280 x 1024), there's no code change between them

In windowed mode, I get the same values as the ones I posted before

BalancePowerTracker isn't updated yet, I wanted to fix this before releasing a new v, but I will release it today, fixed or not.

The width var is 138 atm, the bar frame is 140pix long.

I'll definitely check Blackbox, although I'm considering use a OnUpdate handler, I've seen that Blizz cast bar uses it, I'll create it and check if the CPU increases a lot.

Thank you!
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_081112_120300.jpg
Views:	516
Size:	328.6 KB
ID:	7054  Click image for larger version

Name:	WoWScrnShot_081112_120518.jpg
Views:	494
Size:	228.7 KB
ID:	7055  
  Reply With Quote
08-11-12, 09:54 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
There's a glitch in the animation system in which the effective scale doesn't apply to translation offsets. You'll need to multiply both x and y by the frame's effective scale or in the case of a region object (FontString and Texture) by the parent's effective scale.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
08-12-12, 04:25 AM   #5
Copialinex
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 6
Worked like a charm, thanks!

Originally Posted by SDPhantom View Post
There's a glitch in the animation system in which the effective scale doesn't apply to translation offsets. You'll need to multiply both x and y by the frame's effective scale or in the case of a region object (FontString and Texture) by the parent's effective scale.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Translation animation and screen resolution


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off