motion.js
941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ================== Collapse Motion ==================
var getCollapsedHeight = function getCollapsedHeight() {
return {
height: 0,
opacity: 0
};
};
var getRealHeight = function getRealHeight(node) {
return {
height: node.scrollHeight,
opacity: 1
};
};
var getCurrentHeight = function getCurrentHeight(node) {
return {
height: node.offsetHeight
};
};
var skipOpacityTransition = function skipOpacityTransition(_, event) {
return event.propertyName === 'height';
};
var collapseMotion = {
motionName: 'ant-motion-collapse',
onAppearStart: getCollapsedHeight,
onEnterStart: getCollapsedHeight,
onAppearActive: getRealHeight,
onEnterActive: getRealHeight,
onLeaveStart: getCurrentHeight,
onLeaveActive: getCollapsedHeight,
onAppearEnd: skipOpacityTransition,
onEnterEnd: skipOpacityTransition,
onLeaveEnd: skipOpacityTransition,
motionDeadline: 500
};
export default collapseMotion;