11import cssAnimation from './css-animation' ;
22import { nextTick } from 'vue' ;
3+ import { requestAnimationTimeout , cancelAnimationTimeout } from './requestAnimationTimeout' ;
34
45function animate ( node , show , done ) {
56 let height ;
@@ -8,7 +9,7 @@ function animate(node, show, done) {
89 return cssAnimation ( node , 'ant-motion-collapse-legacy' , {
910 start ( ) {
1011 if ( appearRequestAnimationFrameId ) {
11- cancelAnimationFrame ( appearRequestAnimationFrameId ) ;
12+ cancelAnimationTimeout ( appearRequestAnimationFrameId ) ;
1213 }
1314 if ( ! show ) {
1415 node . style . height = `${ node . offsetHeight } px` ;
@@ -18,7 +19,7 @@ function animate(node, show, done) {
1819 // not get offsetHeight when appear
1920 // set it into raf get correct offsetHeight
2021 if ( height === 0 ) {
21- appearRequestAnimationFrameId = requestAnimationFrame ( ( ) => {
22+ appearRequestAnimationFrameId = requestAnimationTimeout ( ( ) => {
2223 height = node . offsetHeight ;
2324 node . style . height = '0px' ;
2425 node . style . opacity = '0' ;
@@ -31,19 +32,19 @@ function animate(node, show, done) {
3132 } ,
3233 active ( ) {
3334 if ( requestAnimationFrameId ) {
34- cancelAnimationFrame ( requestAnimationFrameId ) ;
35+ cancelAnimationTimeout ( requestAnimationFrameId ) ;
3536 }
36- requestAnimationFrameId = requestAnimationFrame ( ( ) => {
37+ requestAnimationFrameId = requestAnimationTimeout ( ( ) => {
3738 node . style . height = `${ show ? height : 0 } px` ;
3839 node . style . opacity = show ? '1' : '0' ;
3940 } ) ;
4041 } ,
4142 end ( ) {
4243 if ( appearRequestAnimationFrameId ) {
43- cancelAnimationFrame ( appearRequestAnimationFrameId ) ;
44+ cancelAnimationTimeout ( appearRequestAnimationFrameId ) ;
4445 }
4546 if ( requestAnimationFrameId ) {
46- cancelAnimationFrame ( requestAnimationFrameId ) ;
47+ cancelAnimationTimeout ( requestAnimationFrameId ) ;
4748 }
4849 node . style . height = '' ;
4950 node . style . opacity = '' ;
0 commit comments