Thread Tools Display Modes
11-19-12, 11:50 PM   #1
skarie
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2011
Posts: 37
Magic numbers !

Hello,

I am trying to get a set up in which 5 party members frames (5 rectangle squares) sitting on top of a 24 buttons action bar (1 line with 24 buttons).

This is my requirements. Spacing between the buttons is 1px and also true for 2 party member frames.

My problem is that I cannot find the correct numbers so that both party frames and action bar frame to share the same size.

For example:
if button size is 25 px, then 25*24 (buttons) + 23 (spacing between buttons) = 623 px.
Now, I have to figure out how wide each party member should be. 623 - 4 (spaces between members) = 619. But then 619 / 5 (members in a party) = 123.8 px. Here is the problem...according to my math width of each member is 123.8 px and I cannot do 123.8 px, it has to be an whole interger.

Is my math wrong? or just it's impossible to get action bar and party members sharing the same width.

Thanks for all the help.
  Reply With Quote
11-20-12, 12:15 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
The formula works out to:
y = 4.8x + 3.8
... where y is the width of a unit frame, and x is the width of an action button.

There are plenty of integer values of x that will result in an integer y; they're all values that result in 4.8x being N.2 so that adding 3.8 results in an integer:
  • If x = 14, then y = 71.
  • If x = 19, then y = 95.
  • If x = 24, then y = 119.
  • If x = 29, then y = 143.
  • If x = 34, then y = 167.
  • If x = 39, then y = 191.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-20-12, 02:29 AM   #3
skarie
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2011
Posts: 37
Originally Posted by Phanx View Post
The formula works out to:
y = 4.8x + 3.8
... where y is the width of a unit frame, and x is the width of an action button.

There are plenty of integer values of x that will result in an integer y; they're all values that result in 4.8x being N.2 so that adding 3.8 results in an integer:
  • If x = 14, then y = 71.
  • If x = 19, then y = 95.
  • If x = 24, then y = 119.
  • If x = 29, then y = 143.
  • If x = 34, then y = 167.
  • If x = 39, then y = 191.
This is nice...thanks again for the math.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Magic numbers !


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