Skip to content

Commit

Permalink
fix(馃М): remove lerp() (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon committed Oct 22, 2020
1 parent 6c96e99 commit 346074f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
7 changes: 1 addition & 6 deletions src/Math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ export const bin = (value: boolean): 0 | 1 => {

export const mix = (value: number, x: number, y: number) => {
"worklet";
return x + value * (y - x);
};

export const lerp = (x: number, y: number, value: number) => {
"worklet";
return (1 - value) * x + value * y;
return x * (1 - value) + y * value;
};

/**
Expand Down
8 changes: 1 addition & 7 deletions src/__tests__/Math.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
mix,
round,
lerp,
bin,
cubicBezier,
clamp,
Expand Down Expand Up @@ -30,12 +29,7 @@ test("mix()", () => {
expect(mix(0.5, 10, 20)).toBe(15);
expect(mix(0.25, 10, 20)).toBe(12.5);
expect(mix(0.8, 10, 20)).toBe(18);
});

test("lerp()", () => {
expect(lerp(0, 10, 1)).toBe(10);
expect(lerp(1, 10, 0)).toBe(1);
expect(lerp(0, 10, 0.5)).toBe(5);
expect(mix(1.5, 10, 20)).toBe(25);
});

test("cubicBezier()", () => {
Expand Down

0 comments on commit 346074f

Please sign in to comment.