
Jenkin W.
asked 08/30/23what is the right x value?
"Calculator to figure out the x value of an image box based on direction, display width, and the amount of pixels that you don't use (the empty spaces on either side of the screen combined). a_unused is the amount of pixels that you didn't use on both sides combined. d_width is the amount of pixels in the width of the screen. d_direction is the direction, where -100 = 100% Left and +100 = 100% Right."
Formulas: a_used = d_width – a_unused
x = (a_used/2) + (a_used * ((d_direction/100) / 2)) + (a_unused/2)
Question: Why does this formula not work? (For example, if I enter a direction that is negative and should show on the left side, it shows on the right side.)
1 Expert Answer
Mitchell R. answered 09/11/23
Hey! I'd love to help with all of your tutoring needs!
If you're getting the image on the opposite side of the expected direction, it could be due to the sign of d_direction
. Make sure that you're using negative values for left and positive values for right. For example:
-
If you want the image to move 100% to the left,
d_direction
should be -100. -
If you want the image to move 100% to the right,
d_direction
should be 100.
Double-check your input values for d_direction
to ensure that they align with your desired direction.
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Riti B.
Hi Jenkin! Could you elaborate on what "x value" is measuring? For example, is it the width of the image box (# of pixels)? Or is it the x coordinate where the image box should start (e.g., to start at the left side of the screen, x = 0)? Also, the way a_unused is labeled brought up another question: Is a_unused the # of unused pixels in **just the width** of the screen, or is it the **area** of unused pixels (that is, unused width * height of the screen) to the left and right of the image box? If it's the latter, you wouldn't really be able to use the first formula (a_used = d_width - a_unused), correct?09/05/23