flash maths - scaling a number
hi guys,
i need math problem
i need math formula scale number between 400 , 10000
to number between 800 , 8000
in other words 400 return value of 800
10000 return value of 8000
and number between 400 , 10000
would return corresponding answer between
800 , 8000 same percentage along span of numbers.
for example number half way between 400 , 10000
would return number half way between 800 , 8000
i need math problem
i need math formula scale number between 400 , 10000
to number between 800 , 8000
in other words 400 return value of 800
10000 return value of 8000
and number between 400 , 10000
would return corresponding answer between
800 , 8000 same percentage along span of numbers.
for example number half way between 400 , 10000
would return number half way between 800 , 8000
var destlow:number = 800;
var desthigh:number = 8000;
var origlow:number = 400;
var orighigh:number = 1000;
var num:number = 500;
var newnum = destlow+(num-origlow)/(orighigh-origlow)*(desthigh-destlow);
var desthigh:number = 8000;
var origlow:number = 400;
var orighigh:number = 1000;
var num:number = 500;
var newnum = destlow+(num-origlow)/(orighigh-origlow)*(desthigh-destlow);
More discussions in ActionScript 1 and 2
adobe
Comments
Post a Comment