|
1 | 1 | import React, { createElement, cloneElement } from 'react';
|
2 | 2 | import { findDOMNode } from 'react-dom';
|
3 | 3 |
|
4 |
| -let velocity; |
5 |
| -if (typeof document !== 'undefined' && typeof window !== 'undefined') { |
6 |
| - // only load velocity on the client |
7 |
| - velocity = require('velocity-animate'); |
8 |
| -} else { |
9 |
| - // provide a velocity stub for the server |
10 |
| - velocity = function velocityServerDummy() { |
11 |
| - const callback = arguments[arguments.length - 1]; |
12 |
| - // call after stack flushes |
13 |
| - // in case you app depends on the asyncron nature of this function |
14 |
| - setImmediate(function() { |
15 |
| - callback(); |
16 |
| - }); |
17 |
| - }; |
18 |
| -} |
19 |
| - |
20 |
| -import { |
21 |
| - toArrayChildren, |
22 |
| - findChildInChildrenByKey, |
23 |
| - mergeChildren, |
24 |
| - transformArguments, |
25 |
| - getChildrenFromProps, |
26 |
| -} from './utils'; |
27 |
| -import AnimTypes from './animTypes'; |
28 |
| -const BackEase = { |
29 |
| - easeInBack: [0.6, -0.28, 0.735, 0.045], |
30 |
| - easeOutBack: [0.175, 0.885, 0.32, 1.275], |
31 |
| - easeInOutBack: [0.68, -0.55, 0.265, 1.55], |
32 |
| -}; |
33 | 4 | const _ease = {
|
34 | 5 | easeInElastic: function(_p, o, t) {
|
35 | 6 | let p = _p;
|
@@ -96,9 +67,41 @@ const _ease = {
|
96 | 67 | },
|
97 | 68 | };
|
98 | 69 |
|
99 |
| -Object.keys(_ease).forEach(key => { |
100 |
| - velocity.Easings[key] = _ease[key]; |
101 |
| -}); |
| 70 | +let velocity; |
| 71 | +if (typeof document !== 'undefined' && typeof window !== 'undefined') { |
| 72 | + // only load velocity on the client |
| 73 | + velocity = require('velocity-animate'); |
| 74 | + Object.keys(_ease).forEach(key => { |
| 75 | + if (velocity.Easings) { |
| 76 | + velocity.Easings[key] = _ease[key]; |
| 77 | + } |
| 78 | + }); |
| 79 | +} else { |
| 80 | + // provide a velocity stub for the server |
| 81 | + velocity = function velocityServerDummy() { |
| 82 | + const callback = arguments[arguments.length - 1]; |
| 83 | + // call after stack flushes |
| 84 | + // in case you app depends on the asyncron nature of this function |
| 85 | + setImmediate(function() { |
| 86 | + callback(); |
| 87 | + }); |
| 88 | + }; |
| 89 | +} |
| 90 | + |
| 91 | +import { |
| 92 | + toArrayChildren, |
| 93 | + findChildInChildrenByKey, |
| 94 | + mergeChildren, |
| 95 | + transformArguments, |
| 96 | + getChildrenFromProps, |
| 97 | +} from './utils'; |
| 98 | +import AnimTypes from './animTypes'; |
| 99 | +const BackEase = { |
| 100 | + easeInBack: [0.6, -0.28, 0.735, 0.045], |
| 101 | + easeOutBack: [0.175, 0.885, 0.32, 1.275], |
| 102 | + easeInOutBack: [0.68, -0.55, 0.265, 1.55], |
| 103 | +}; |
| 104 | + |
102 | 105 | const placeholderKeyPrefix = 'ant-queue-anim-placeholder-';
|
103 | 106 |
|
104 | 107 | class QueueAnim extends React.Component {
|
|
0 commit comments