Math question
Peter Bogdanoff
bogdanoff at me.com
Fri Feb 26 00:09:22 EST 2016
Hi,
I’m seriously math deficient.
In my application’s preferences I have a slider that the user can set a value from +5 down to -5, where 0 is the default and the user can then modify that.
The result is currently linear but I’m thinking that I want finer control around the zero midpoint but coarser results at either end of the control. So I’m needing a non-linear scale of some sort.
This is the current script. tData is a number 5 to -5. 60 was an arbitrary number chosen to provide similar results on the two platforms (a span of 600, which is the timescale of an audio file—I can vary the speed of time events by 1 second):
function calcBlockOffsetGlobal tData
if the machine contains "x86" then
put -300 into defaultSetting # Windows default
else
put 80 into defaultSetting # Mac default
end if
put defaultSetting + (60 * tData) into tOffset
return tOffset
end calcBlockOffsetGlobal
How would one modify this to return tOffset as a smaller change when tData is near zero, and the opposite when tData is near the maximum?
Peter Bogdanoff
UCLA
ps. I saw a t-shirt yesterday that said “Well, another day passed and I didn't use Algebra."
More information about the use-livecode
mailing list