@chao-component/bag-animation-ui 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -2
- package/dist/index.mjs +7 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -845,7 +845,12 @@ function BagAnimation({
|
|
|
845
845
|
}
|
|
846
846
|
}, [isAnimating]);
|
|
847
847
|
(0, import_react.useEffect)(() => {
|
|
848
|
-
if (!isAnimating || !canvasRef.current || !hasChances)
|
|
848
|
+
if (!isAnimating || !canvasRef.current || !hasChances) {
|
|
849
|
+
if (!hasChances && isAnimating) {
|
|
850
|
+
setIsAnimating(false);
|
|
851
|
+
}
|
|
852
|
+
return;
|
|
853
|
+
}
|
|
849
854
|
const canvas = canvasRef.current;
|
|
850
855
|
const ctx = canvas.getContext("2d");
|
|
851
856
|
if (!ctx) return;
|
|
@@ -940,7 +945,7 @@ function BagAnimation({
|
|
|
940
945
|
animationRefs.current[frame].stop();
|
|
941
946
|
}
|
|
942
947
|
};
|
|
943
|
-
}, [frame, isAnimating,
|
|
948
|
+
}, [frame, isAnimating, doneFunction]);
|
|
944
949
|
(0, import_react.useEffect)(() => {
|
|
945
950
|
if (isPausedAtThird && thirdFrameCtxRef.current && thirdFrameApngRef.current && thirdFramePlayerRef.current && canvasRef.current && thirdFrameOriginalSizeRef.current) {
|
|
946
951
|
const apng = thirdFrameApngRef.current;
|
package/dist/index.mjs
CHANGED
|
@@ -829,7 +829,12 @@ function BagAnimation({
|
|
|
829
829
|
}
|
|
830
830
|
}, [isAnimating]);
|
|
831
831
|
useEffect(() => {
|
|
832
|
-
if (!isAnimating || !canvasRef.current || !hasChances)
|
|
832
|
+
if (!isAnimating || !canvasRef.current || !hasChances) {
|
|
833
|
+
if (!hasChances && isAnimating) {
|
|
834
|
+
setIsAnimating(false);
|
|
835
|
+
}
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
833
838
|
const canvas = canvasRef.current;
|
|
834
839
|
const ctx = canvas.getContext("2d");
|
|
835
840
|
if (!ctx) return;
|
|
@@ -924,7 +929,7 @@ function BagAnimation({
|
|
|
924
929
|
animationRefs.current[frame].stop();
|
|
925
930
|
}
|
|
926
931
|
};
|
|
927
|
-
}, [frame, isAnimating,
|
|
932
|
+
}, [frame, isAnimating, doneFunction]);
|
|
928
933
|
useEffect(() => {
|
|
929
934
|
if (isPausedAtThird && thirdFrameCtxRef.current && thirdFrameApngRef.current && thirdFramePlayerRef.current && canvasRef.current && thirdFrameOriginalSizeRef.current) {
|
|
930
935
|
const apng = thirdFrameApngRef.current;
|