@@ -29,7 +29,7 @@ const SubTween = (start, end, roundv = 10000) => {
2929 if ( Array . isArray ( start ) ) {
3030 let isColorPropsExist = null ;
3131 let startIndex = null
32- end = end . map ( ( v , i ) => colorMatch . test ( v ) ? ( isColorPropsExist = v , startIndex = i , null ) : v === start [ i ] ? null : typeof v === "number" ? v - start [ i ] : typeof v === "string" ? v : SubTween ( start [ i ] , v ) ) ;
32+ end = end . map ( ( v , i ) => colorMatch . test ( v ) ? ( isColorPropsExist = v , startIndex = i , null ) : v === start [ i ] ? null : typeof v === "number" ? v - start [ i ] : SubTween ( start [ i ] , v ) ) ;
3333 let endIndex = startIndex !== null ? startIndex + 6 : null ;
3434 if ( isColorPropsExist && isIncrementReqForColor . test ( isColorPropsExist ) ) {
3535 startIndex ++ ;
@@ -56,10 +56,10 @@ const SubTween = (start, end, roundv = 10000) => {
5656 for ( let property in end ) {
5757 if ( end [ property ] === start [ property ] ) {
5858 end [ property ] = null ;
59- } else if ( typeof end [ property ] === "object" ) {
60- end [ property ] = SubTween ( start [ property ] , end [ property ] ) ;
6159 } else if ( typeof start [ property ] === "number" ) {
6260 end [ property ] -= start [ property ] ;
61+ } else if ( typeof end [ property ] === "object" || typeof [ end ] === "string" ) {
62+ end [ property ] = SubTween ( start [ property ] , end [ property ] ) ;
6363 }
6464 }
6565 let map = { ...start } ;
@@ -94,6 +94,8 @@ const SubTween = (start, end, roundv = 10000) => {
9494 }
9595 return s
9696 }
97+ } else if ( typeof end === "function" ) {
98+ return end ;
9799 } else {
98100 let isSame = start === end ;
99101 return ( t ) => isSame ? start : t >= 0.5 ? end : start ;
0 commit comments