mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
removing exponent member
This commit is contained in:
parent
4c3cf0d8fc
commit
7f660730df
2 changed files with 2 additions and 19 deletions
|
@ -20,6 +20,7 @@ define(["Tone/core/Tone", "Tone/core/Type"], function (Tone) {
|
|||
* ]);
|
||||
* @param {Array} values The array of values to interpolate over
|
||||
* @param {Positive} index The initial interpolation index.
|
||||
* @extends {Tone}
|
||||
*/
|
||||
Tone.CtrlInterpolate = function(){
|
||||
|
||||
|
@ -43,12 +44,6 @@ define(["Tone/core/Tone", "Tone/core/Type"], function (Tone) {
|
|||
* @type {Positive}
|
||||
*/
|
||||
this.index = options.index;
|
||||
|
||||
/**
|
||||
* Use an exponent to ease between values.
|
||||
* @type {Positive}
|
||||
*/
|
||||
this.exponent = options.exponent;
|
||||
};
|
||||
|
||||
Tone.extend(Tone.CtrlInterpolate);
|
||||
|
@ -60,12 +55,11 @@ define(["Tone/core/Tone", "Tone/core/Type"], function (Tone) {
|
|||
*/
|
||||
Tone.CtrlInterpolate.defaults = {
|
||||
"index" : 0,
|
||||
"exponent" : 1,
|
||||
"values" : []
|
||||
};
|
||||
|
||||
/**
|
||||
* The current interpolated value based on the index and exponent
|
||||
* The current interpolated value based on the index
|
||||
* @readOnly
|
||||
* @memberOf Tone.CtrlInterpolate#
|
||||
* @type {*}
|
||||
|
@ -106,7 +100,6 @@ define(["Tone/core/Tone", "Tone/core/Type"], function (Tone) {
|
|||
} else {
|
||||
lower = this._toNumber(lower);
|
||||
upper = this._toNumber(upper);
|
||||
index = Math.pow(index, this.exponent);
|
||||
return (1 - index) * lower + index * upper;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -17,11 +17,9 @@ define(["Tone/control/CtrlInterpolate", "helper/Basic"], function (CtrlInterpola
|
|||
var terp = new CtrlInterpolate({
|
||||
values : [1, 2, 3],
|
||||
index : 1,
|
||||
exponent : 4
|
||||
});
|
||||
expect(terp.values).to.deep.equal([1, 2, 3]);
|
||||
expect(terp.index).to.equal(1);
|
||||
expect(terp.exponent).to.equal(4);
|
||||
terp.dispose();
|
||||
});
|
||||
|
||||
|
@ -49,14 +47,6 @@ define(["Tone/control/CtrlInterpolate", "helper/Basic"], function (CtrlInterpola
|
|||
terp.dispose();
|
||||
});
|
||||
|
||||
it ("can exponentially interpolate values", function(){
|
||||
var terp = new CtrlInterpolate([3, 2, 1, 0], 0);
|
||||
terp.exponent = 2;
|
||||
expect(terp.value).to.equal(3);
|
||||
terp.index = 0.5;
|
||||
expect(terp.value).to.equal(2.75);
|
||||
terp.dispose();
|
||||
});
|
||||
|
||||
it ("can be done over an array of arrays", function(){
|
||||
var terp = new CtrlInterpolate([[1, 2, 3], [4, 4, 4]], 0.25);
|
||||
|
|
Loading…
Reference in a new issue