avocado/packages/timing/test/lfo.js
2021-02-04 00:03:54 -06:00

26 lines
504 B
JavaScript

import {expect} from 'chai';
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);
});