|
|
|
@ -3,18 +3,18 @@ import getRequestAnimationFrame, { cancelRequestAnimationFrame } from './getRequ
|
|
|
|
|
|
|
|
|
|
const reqAnimFrame = getRequestAnimationFrame();
|
|
|
|
|
|
|
|
|
|
function animate(node, show, done) {
|
|
|
|
|
let height;
|
|
|
|
|
let requestAnimationFrameId;
|
|
|
|
|
function animate(node: HTMLElement, show: boolean, done: () => void) {
|
|
|
|
|
let height: number;
|
|
|
|
|
let requestAnimationFrameId: number;
|
|
|
|
|
return cssAnimation(node, 'ant-motion-collapse', {
|
|
|
|
|
start() {
|
|
|
|
|
if (!show) {
|
|
|
|
|
node.style.height = `${node.offsetHeight}px`;
|
|
|
|
|
node.style.opacity = 1;
|
|
|
|
|
node.style.opacity = '1';
|
|
|
|
|
} else {
|
|
|
|
|
height = node.offsetHeight;
|
|
|
|
|
node.style.height = 0;
|
|
|
|
|
node.style.opacity = 0;
|
|
|
|
|
node.style.height = '0 px';
|
|
|
|
|
node.style.opacity = '0';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
active() {
|
|
|
|
@ -23,7 +23,7 @@ function animate(node, show, done) {
|
|
|
|
|
}
|
|
|
|
|
requestAnimationFrameId = reqAnimFrame(() => {
|
|
|
|
|
node.style.height = `${show ? height : 0}px`;
|
|
|
|
|
node.style.opacity = show ? 1 : 0;
|
|
|
|
|
node.style.opacity = show ? '1' : '0';
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
end() {
|
|
|
|
@ -38,13 +38,13 @@ function animate(node, show, done) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const animation = {
|
|
|
|
|
enter(node, done) {
|
|
|
|
|
enter(node: HTMLElement, done: () => void) {
|
|
|
|
|
return animate(node, true, done);
|
|
|
|
|
},
|
|
|
|
|
leave(node, done) {
|
|
|
|
|
leave(node: HTMLElement, done: () => void) {
|
|
|
|
|
return animate(node, false, done);
|
|
|
|
|
},
|
|
|
|
|
appear(node, done) {
|
|
|
|
|
appear(node: HTMLElement, done: () => void) {
|
|
|
|
|
return animate(node, true, done);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|