N
N
nikmil2019-10-02 11:55:19
JavaScript
nikmil, 2019-10-02 11:55:19

How to write the correct formula for the width?

Hello, I have a slider with a strip, the strip has a value of width.
If value has 100 then the width value is 100%
And how to make it so that min= -100 max= 100 and with value=0 the width is 50%?
let's say
100 = 100% (width)
0 = 50%
-100= 0%
What is the formula for the width of the strip in this case?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2019-10-02
@Rsa97

0a + ​​b = -100
100a + b = 100
System of linear equations, 7th grade of secondary school.

A
Anton Fedoryan, 2019-10-02
@AnnTHony

width = 50 + value / 2

50 + 100 / 2 = 100% (value = 100)
50 - 100 / 2 = 0% (value = -100)
50 + 50 / 2 = 75% (value = 50)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question