Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit 8e9e1f7

Browse files
committed
fix(git): becauseof git, we missed file that caused unrelease
1 parent 03e142a commit 8e9e1f7

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/dist/SubTween.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const SubTween = (start, end, roundv = 100000) => {
2+
if (Array.isArray(start)) {
3+
end = end.map((v, i) => v === start[i] ? null : typeof v === "number" ? v - start[i] : typeof v === "string" ? v : SubTween(start[i], v));
4+
let map = [...start];
5+
return (t) => {
6+
for ( let i = 0, length = end.length; i < length; i++ ) {
7+
let v = end[i];
8+
if ( typeof v === "function" ) {
9+
map[i] = v(t);
10+
} else if (typeof v === "number") {
11+
map[i] = (((start[i] + v * t) * roundv) | 0) / roundv;
12+
}
13+
}
14+
return map;
15+
}
16+
} else if (typeof start === "object") {
17+
for ( let property in end ) {
18+
if (end[property] === start[property]) {
19+
end[property] = null;
20+
} else if ( typeof end[property] === "object" ) {
21+
end[property] = SubTween(start[property], end[property]);
22+
} else if (typeof start[property] === "number") {
23+
end[property] -= start[property];
24+
}
25+
}
26+
let map = {...start};
27+
return (t) => {
28+
for ( let property in end ) {
29+
let to = end[property];
30+
if ( typeof to === "function" ) {
31+
map[property] = to(t);
32+
} else if (typeof to === "number") {
33+
map[property] = (((start[property] + to * t) * roundv) | 0) / roundv;
34+
}
35+
}
36+
return map;
37+
}
38+
} else if (typeof start === "number") {
39+
end -= start;
40+
let isSame = start === end;
41+
return (t) => {
42+
return isSame ? end : (((start + end * t) * roundv) | 0) / roundv;
43+
}
44+
} else {
45+
let isSame = start === end;
46+
return (t) => isSame ? start : t >= 0.5 ? end : start;
47+
}
48+
}
49+
export default SubTween;

0 commit comments

Comments
 (0)