@@ -29,7 +29,7 @@ const SubTween = (start, end, roundv = 10000) => {
29
29
if ( Array . isArray ( start ) ) {
30
30
let isColorPropsExist = null ;
31
31
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 ) ) ;
33
33
let endIndex = startIndex !== null ? startIndex + 6 : null ;
34
34
if ( isColorPropsExist && isIncrementReqForColor . test ( isColorPropsExist ) ) {
35
35
startIndex ++ ;
@@ -56,10 +56,10 @@ const SubTween = (start, end, roundv = 10000) => {
56
56
for ( let property in end ) {
57
57
if ( end [ property ] === start [ property ] ) {
58
58
end [ property ] = null ;
59
- } else if ( typeof end [ property ] === "object" ) {
60
- end [ property ] = SubTween ( start [ property ] , end [ property ] ) ;
61
59
} else if ( typeof start [ property ] === "number" ) {
62
60
end [ property ] -= start [ property ] ;
61
+ } else if ( typeof end [ property ] === "object" || typeof [ end ] === "string" ) {
62
+ end [ property ] = SubTween ( start [ property ] , end [ property ] ) ;
63
63
}
64
64
}
65
65
let map = { ...start } ;
@@ -94,6 +94,8 @@ const SubTween = (start, end, roundv = 10000) => {
94
94
}
95
95
return s
96
96
}
97
+ } else if ( typeof end === "function" ) {
98
+ return end ;
97
99
} else {
98
100
let isSame = start === end ;
99
101
return ( t ) => isSame ? start : t >= 0.5 ? end : start ;
0 commit comments