2021-01-05 02:47:30 -06:00
|
|
|
import {expect} from 'chai';
|
|
|
|
|
2021-02-04 00:03:54 -06:00
|
|
|
import LfoResult from '../src/lfo/result';
|
|
|
|
|
|
|
|
it('can do linear oscillation', () => {
|
|
|
|
const object = {x: 0};
|
|
|
|
const result = new LfoResult(
|
|
|
|
object,
|
|
|
|
{
|
|
|
|
x: {
|
|
|
|
frequency: 1,
|
|
|
|
magnitude: 100,
|
|
|
|
median: 50,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
result.tick(0.1);
|
|
|
|
expect(object.x).to.equal(10);
|
|
|
|
result.tick(0.5);
|
|
|
|
expect(object.x).to.equal(60);
|
|
|
|
result.tick(0.25);
|
|
|
|
expect(object.x).to.equal(85);
|
|
|
|
result.tick(0.4);
|
|
|
|
expect(object.x).to.equal(25);
|
2021-01-05 02:47:30 -06:00
|
|
|
});
|