Skip to content

Commit 2295796

Browse files
committed
fix when repeating not in the current window, there is no reset initial value
1 parent 3983f8b commit 2295796

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-tween-one",
3-
"version": "2.2.18",
3+
"version": "2.2.19",
44
"description": "tween-one anim component for react",
55
"keywords": [
66
"react",

src/TweenOne.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class TweenOne extends Component {
4545
this.paused = props.paused;
4646
this.reverse = props.reverse;
4747
this.updateAnim = false;
48+
this.repeatNum = 0;
4849
this.forced = {};
4950
this.setForcedJudg(props);
5051
}
@@ -236,7 +237,7 @@ class TweenOne extends Component {
236237
this.tween.frame(this.tween.totalTime * repeatNum);
237238
}
238239
if (moment < this.moment && !this.reverse ||
239-
repeat !== 0 && repeatNum && tweenMoment <= perFrame
240+
repeat !== 0 && repeatNum && repeatNum !== this.repeatNum
240241
) {
241242
// 在 form 状态下,暂停时拉 moment 时,start 有值,,往返方向播放时,在 delay 的时间没有处理。。
242243
// 与上面的处理一样,删除 start ,重新走一遍 start。。
@@ -273,6 +274,7 @@ class TweenOne extends Component {
273274
this.props.onChange(cb);
274275
};
275276
this.moment = moment;
277+
this.repeatNum = repeatNum;
276278
this.tween.frame(tweenMoment);
277279
}
278280

0 commit comments

Comments
 (0)