Reply
 
Thread Tools Display Modes
Old 11-19-12, 10: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.
skarie is offline   Reply With Quote
Old 11-19-12, 11:15 PM   #2
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,945
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.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Old 11-20-12, 01: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.
skarie is offline   Reply With Quote
Reply

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

Thread Tools
Display Modes

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