We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4fe3689 commit b747e6eCopy full SHA for b747e6e
src/packages/core/utils/math/lerp.test.ts
@@ -0,0 +1,15 @@
1
+import { expect } from '@open-wc/testing';
2
+import { lerp } from './math.js';
3
+
4
+describe('lerp', () => {
5
+ it('Interpolate between two values.', () => {
6
+ expect(lerp(1, 20, 0.5)).to.equal(10.5);
7
+ expect(lerp(1, 100, 0.2)).to.equal(20.8);
8
+ expect(lerp(2, 23, 0.4)).to.equal(10.4);
9
+ expect(lerp(50, 250, 0.8)).to.equal(210);
10
+ });
11
12
+ it('Ensure alpha is clamped to the range [0, 1].', () => {
13
+ expect(lerp(10, 20, 1.5)).to.equal(20);
14
15
+});
0 commit comments