|
1 | 1 | import { Layer } from 'expression-globals-typescript'; |
2 | | -import { animate } from './index'; |
| 2 | +import { animate, interpolators } from './index'; |
3 | 3 |
|
4 | 4 | // This let's Jest: ReferenceError: Cannot access before initialization |
5 | 5 | // https://stackoverflow.com/questions/61157392/jest-mock-aws-sdk-referenceerror-cannot-access-before-initialization |
@@ -80,6 +80,42 @@ test('animates with custom linear interpolator', () => { |
80 | 80 | ).toBe(0.5); |
81 | 81 | }); |
82 | 82 |
|
| 83 | +test('animates with provided linear interpolator', () => { |
| 84 | + expect( |
| 85 | + animate( |
| 86 | + [ |
| 87 | + { keyTime: 0, keyValue: 0 }, |
| 88 | + { keyTime: 1, keyValue: 1 }, |
| 89 | + ], |
| 90 | + { inputTime: 0.5, interpolator: interpolators.linear } |
| 91 | + ) |
| 92 | + ).toBe(0.5); |
| 93 | +}); |
| 94 | + |
| 95 | +test('animates with provided easeInOutQuad interpolator', () => { |
| 96 | + expect( |
| 97 | + animate( |
| 98 | + [ |
| 99 | + { keyTime: 0, keyValue: 0 }, |
| 100 | + { keyTime: 1, keyValue: 1 }, |
| 101 | + ], |
| 102 | + { inputTime: 0.25, interpolator: interpolators.easeInOutQuad } |
| 103 | + ) |
| 104 | + ).toBe(0.125); |
| 105 | +}); |
| 106 | + |
| 107 | +test('animates with provided elastic interpolator', () => { |
| 108 | + expect( |
| 109 | + animate( |
| 110 | + [ |
| 111 | + { keyTime: 0, keyValue: 0 }, |
| 112 | + { keyTime: 2, keyValue: 1 }, |
| 113 | + ], |
| 114 | + { inputTime: 2, interpolator: interpolators.easeInElastic } |
| 115 | + ) |
| 116 | + ).toBe(1); |
| 117 | +}); |
| 118 | + |
83 | 119 | test('animates with custom quad interpolator', () => { |
84 | 120 | expect( |
85 | 121 | animate( |
|
0 commit comments