main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
729 bytes
|
Line | |
---|
1 | import { easing } from 'ts-easing';
|
---|
2 | import useRaf from './useRaf';
|
---|
3 | var useTween = function (easingName, ms, delay) {
|
---|
4 | if (easingName === void 0) { easingName = 'inCirc'; }
|
---|
5 | if (ms === void 0) { ms = 200; }
|
---|
6 | if (delay === void 0) { delay = 0; }
|
---|
7 | var fn = easing[easingName];
|
---|
8 | var t = useRaf(ms, delay);
|
---|
9 | if (process.env.NODE_ENV !== 'production') {
|
---|
10 | if (typeof fn !== 'function') {
|
---|
11 | console.error('useTween() expected "easingName" property to be a valid easing function name, like:' +
|
---|
12 | '"' +
|
---|
13 | Object.keys(easing).join('", "') +
|
---|
14 | '".');
|
---|
15 | console.trace();
|
---|
16 | return 0;
|
---|
17 | }
|
---|
18 | }
|
---|
19 | return fn(t);
|
---|
20 | };
|
---|
21 | export default useTween;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.