Skip to content

Commit 48d910d

Browse files
committed
Make curve map side-effect-free
1 parent 60beae7 commit 48d910d

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

src/core/data-structures/curve.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// Imported just for the side effect of getting the `types` it exports into
1818
// the type system during compile time.
1919
import {NormTimeDef} from '../types/date';
20+
import {once} from '../types/function';
2021

2122
/**
2223
* A CurveDef is a function that returns a normtime value (0 to 1) for another
@@ -250,25 +251,17 @@ export const Curves = {
250251
return n;
251252
},
252253

253-
/**
254-
* ease
255-
*/
256-
EASE: bezierCurve(0.25, 0.1, 0.25, 1.0),
254+
/** ease */
255+
EASE: once(bezierCurve)(0.25, 0.1, 0.25, 1.0),
257256

258-
/**
259-
* ease-in: slow out, fast in
260-
*/
261-
EASE_IN: bezierCurve(0.42, 0.0, 1.0, 1.0),
257+
/** ease-in: slow out, fast in */
258+
EASE_IN: once(bezierCurve)(0.42, 0.0, 1.0, 1.0),
262259

263-
/**
264-
* ease-out: fast out, slow in
265-
*/
266-
EASE_OUT: bezierCurve(0.0, 0.0, 0.58, 1.0),
260+
/** ease-out: fast out, slow in */
261+
EASE_OUT: once(bezierCurve)(0.0, 0.0, 0.58, 1.0),
267262

268-
/**
269-
* ease-in-out
270-
*/
271-
EASE_IN_OUT: bezierCurve(0.42, 0.0, 0.58, 1.0),
263+
/** ease-in-out */
264+
EASE_IN_OUT: once(bezierCurve)(0.42, 0.0, 0.58, 1.0),
272265
};
273266

274267
/**

0 commit comments

Comments
 (0)