@@ -25,13 +25,82 @@ import {
25
25
getChildrenFromProps ,
26
26
} from './utils' ;
27
27
import AnimTypes from './animTypes' ;
28
-
29
28
const BackEase = {
30
29
easeInBack : [ 0.6 , - 0.28 , 0.735 , 0.045 ] ,
31
30
easeOutBack : [ 0.175 , 0.885 , 0.32 , 1.275 ] ,
32
31
easeInOutBack : [ 0.68 , - 0.55 , 0.265 , 1.55 ] ,
33
32
} ;
33
+ const _ease = {
34
+ easeInElastic : function ( _p , o , t ) {
35
+ let p = _p ;
36
+ const _p1 = o >= 1 ? o : 1 ;
37
+ const _p2 = ( t || 1 ) / ( o < 1 ? o : 1 ) ;
38
+ const _p3 = _p2 / Math . PI * 2 * ( Math . asin ( 1 / _p1 ) || 0 ) ;
39
+ return - ( _p1 * Math . pow ( 2 , 10 * ( p -= 1 ) ) * Math . sin ( ( p - _p3 ) * _p2 ) ) ;
40
+ } ,
41
+ easeOutElastic : function ( p , o , t ) {
42
+ const _p1 = o >= 1 ? o : 1 ;
43
+ const _p2 = ( t || 1 ) / ( o < 1 ? o : 1 ) ;
44
+ const _p3 = _p2 / Math . PI * 2 * ( Math . asin ( 1 / _p1 ) || 0 ) ;
45
+ return _p1 * Math . pow ( 2 , - 10 * p ) * Math . sin ( ( p - _p3 ) * _p2 ) + 1 ;
46
+ } ,
47
+ easeInOutElastic : function ( _p , o , t ) {
48
+ let p = _p ;
49
+ const _p1 = o >= 1 ? o : 1 ;
50
+ const _p2 = ( t || 1 ) / ( o < 1 ? o : 1 ) ;
51
+ const _p3 = _p2 / Math . PI * 2 * ( Math . asin ( 1 / _p1 ) || 0 ) ;
52
+ const a = - 0.5 * ( _p1 * Math . pow ( 2 , 10 * ( p -= 1 ) ) * Math . sin ( ( p - _p3 ) * _p2 ) ) ;
53
+ const b = _p1 * Math . pow ( 2 , - 10 * ( p -= 1 ) ) * Math . sin ( ( p - _p3 ) * _p2 ) * 0.5 + 1 ;
54
+ p *= 2 ;
55
+ return p < 1 ? a : b ;
56
+ } ,
57
+ easeInBounce : function ( _p ) {
58
+ let p = _p ;
59
+ const __p = 1 - p ;
60
+ if ( __p < 1 / 2.75 ) {
61
+ return 1 - ( 7.5625 * p * p ) ;
62
+ } else if ( p < 2 / 2.75 ) {
63
+ return 1 - ( 7.5625 * ( p -= 1.5 / 2.75 ) * p + 0.75 ) ;
64
+ } else if ( p < 2.5 / 2.75 ) {
65
+ return 1 - ( 7.5625 * ( p -= 2.25 / 2.75 ) * p + 0.9375 ) ;
66
+ }
67
+ return 1 - ( 7.5625 * ( p -= 2.625 / 2.75 ) * p + 0.984375 ) ;
68
+ } ,
69
+ easeOutBounce : function ( _p ) {
70
+ let p = _p ;
71
+ if ( p < 1 / 2.75 ) {
72
+ return 7.5625 * p * p ;
73
+ } else if ( p < 2 / 2.75 ) {
74
+ return 7.5625 * ( p -= 1.5 / 2.75 ) * p + 0.75 ;
75
+ } else if ( p < 2.5 / 2.75 ) {
76
+ return 7.5625 * ( p -= 2.25 / 2.75 ) * p + 0.9375 ;
77
+ }
78
+ return 7.5625 * ( p -= 2.625 / 2.75 ) * p + 0.984375 ;
79
+ } ,
80
+ easeInOutBounce : function ( _p ) {
81
+ let p = _p ;
82
+ const invert = ( p < 0.5 ) ;
83
+ if ( invert ) {
84
+ p = 1 - ( p * 2 ) ;
85
+ } else {
86
+ p = ( p * 2 ) - 1 ;
87
+ }
88
+ if ( p < 1 / 2.75 ) {
89
+ p = 7.5625 * p * p ;
90
+ } else if ( p < 2 / 2.75 ) {
91
+ p = 7.5625 * ( p -= 1.5 / 2.75 ) * p + 0.75 ;
92
+ } else if ( p < 2.5 / 2.75 ) {
93
+ p = 7.5625 * ( p -= 2.25 / 2.75 ) * p + 0.9375 ;
94
+ } else {
95
+ p = 7.5625 * ( p -= 2.625 / 2.75 ) * p + 0.984375 ;
96
+ }
97
+ return invert ? ( 1 - p ) * 0.5 : p * 0.5 + 0.5 ;
98
+ } ,
99
+ } ;
34
100
101
+ Object . keys ( _ease ) . forEach ( key => {
102
+ velocity . Easings [ key ] = _ease [ key ] ;
103
+ } ) ;
35
104
const placeholderKeyPrefix = 'ant-queue-anim-placeholder-' ;
36
105
37
106
class QueueAnim extends React . Component {
@@ -182,7 +251,7 @@ class QueueAnim extends React.Component {
182
251
performEnterBegin ( key , i ) {
183
252
const childrenShow = this . state . childrenShow ;
184
253
childrenShow [ key ] = true ;
185
- this . setState ( { childrenShow} , this . realPerformEnter . bind ( this , key , i ) ) ;
254
+ this . setState ( { childrenShow } , this . realPerformEnter . bind ( this , key , i ) ) ;
186
255
}
187
256
188
257
realPerformEnter ( key , i ) {
0 commit comments