[SOLVED] Moving Battery Indicator - Y Axis

Hi,

Can anyone guide me on making a moving battery indicator that moves up to down as illustrated in the picture below:

Top being 100% and below is 0%.

I’ve tried using the #BLN# conditional at the Y axis, but it always turns out error.

anyone can help me out?

Hey whats up H8,
Your battery level is going to swing from 0-100 and you’re forced to work with that range. So basically you’re wrestling with three parameters:
a. How many pixels do you want your pointer to move?
b. What Y position do you want the pointer to start at?
c. Which direction is the pointer moving? up or down as the battery drains?

a. HOW MANY PIXELS TO MOVE: So this is pretty straight forward. If your gauge is 100 pixels high then no problem, your pointer will move 100 pixels as the battery drains from 100 to 0 with just #BLN#. But if your gauge is only 50 pixels high then you have to scale your movement down by half like this: (#BLN# * 0.5). If your gauge was only 37 pixels high, then this: (#BLN * 0.37). You are essentially scaling the maximum battery (100) to equal the maximum gauge pixels (37). 100 x 0.37 = 37.

b. WHERE TO START (Y): You’ve probably been playing with this already. If you don’t have a Y offset value, the gauge starts all the way at the top of the Creator window. Simply add how many pixels down you want to start the gauge. Let’s say the top of your gauge (100%) is 53 pixels down from the top, then this: ((#BLN * 0.37) + 53). 84 pixels down from the top: ((#BLN * 0.37) + 84)

c. UP OR DOWN?: This one is a little tricky. in your post, you want your pointer to move down with battery loss. Unfortunately, the Y position gets larger as you move down, so you’re kind of working upside down. You would subtract the whole formula from the maximum pixel travel from (a) above. In the 37-pixel example: (37 - (#BLN# * 0.37)) will still move 37 pixels in total but will do so the down direction. (#BLN# * 0.37) only will also move 37 pixels but in the up direction. You can check this by dragging the Creator time left and right with your mouse. You still have the offset to consider from (b) above. So a 37 pixel move starting 53 pixels down and moving from top to bottom would look like this:

(37 - (#BLN# * 0.37) +53)

Lastly, you can decide if you want to combine the 37 and the 53 into 90 like this: (90 - (#BLN# * 0.37)). It’s the same formula with the same results, but I wanted to explain how you would get there.

Be cautious with correct parentheses ()… (( ))… ( ())… otherwise it wont work
HTH,
John

1 Like

top is for 100. it rest at y = 97
down would be 0 at y = 174
difference is 77

OMG John. that works like a charm. thank you so much.

no worries man. Glad it worked out. From your numbers:
top is for 100. it rest at y = 97
down would be 0 at y = 174
difference is 77

I assume you did something like (77 - (#BLN# * 0.77) +97) or combined: (174 - (#BLN# * 0.77))

  • John

On this same note, I’m trying to get a bar to move left as the battery goes down. I’ve tried using a plan line shape and can’t get it to work. The line either starts way off or it moves the wrong way…ideas?