You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
724 B
37 lines
724 B
9 years ago
|
import cssAnimation from 'css-animation';
|
||
9 years ago
|
|
||
9 years ago
|
function animate(node, show, done) {
|
||
|
let height;
|
||
|
return cssAnimation(node, 'ant-motion-collapse', {
|
||
|
start() {
|
||
|
if (!show) {
|
||
|
node.style.height = `${node.offsetHeight}px`;
|
||
|
} else {
|
||
|
height = node.offsetHeight;
|
||
|
node.style.height = 0;
|
||
|
}
|
||
|
},
|
||
|
active() {
|
||
|
node.style.height = `${show ? height : 0}px`;
|
||
|
},
|
||
|
end() {
|
||
|
node.style.height = '';
|
||
9 years ago
|
done();
|
||
9 years ago
|
},
|
||
9 years ago
|
});
|
||
|
}
|
||
|
|
||
|
const animation = {
|
||
|
enter(node, done) {
|
||
9 years ago
|
return animate(node, true, done);
|
||
9 years ago
|
},
|
||
|
leave(node, done) {
|
||
9 years ago
|
return animate(node, false, done);
|
||
9 years ago
|
},
|
||
|
appear(node, done) {
|
||
9 years ago
|
return animate(node, true, done);
|
||
9 years ago
|
},
|
||
|
};
|
||
|
|
||
9 years ago
|
export default animation;
|