javascript - Relative "crossing" percent calculation -


I have this math problem: I should know the formula to get something like this: 70% (x) = 100 150% (x) = 150% of 150% (x) = 50% = 70% of% (x) = 70% 200% (x) = 25% of 70%

It sounds easy, but I'm stuck with this small issue. Please note, (x) is a variable and is irrelevant to this calculation.

For more information, I am computing the offset of an image, the offset should be relative to the resizing. This is an example (the width test is 1920 px, the original offset is 70 px):

  50% of 1920 = 150 = 150% = 105 100% = 100 = 70% 70 = 70 150% of 1920 = 70% = 50% = 20 = 20% 200 = 25% 70 = 17,5 ...   

The final code is in javascript.

* Edit *

In fact, I need to understand how I increase a value and at the same time synchronize each other Subtract

  ... 25% ==> 200% 50% ==> 150% 100% ==> 100% 150% == & gt; 50% 200% ==> 25% ...   

is render (sorry that it is created quickly) To present this way In fact, for my calculations, "70" is more stable My image is bigger (> 100%) More My offset should be small It also applies in the opposite position (my image is small & lt; 100%, more my offset should be bigger)

I am afraid that it is not at least one linear equation:

  test function (x) {return x * -1 + 200} warning (test (50)) // fine 150 warning (test (100)) // fine 100 warning (test (150)) // OK 50 warning (test (200)) // incorrect 0   



Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -