Skip to content

Commit cee9ab9

Browse files
authored
Merge pull request #7 from freestylejs/6-bug-lagged-behind-when-calling-start-very-fast-and-iteratively
[bug] lagged behind when calling start very fast and iteratively
2 parents 60f233e + 8ec10a3 commit cee9ab9

File tree

9 files changed

+642
-644
lines changed

9 files changed

+642
-644
lines changed

packages/core/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @freestylejs/ani-core
22

3+
## 1.2.1
4+
5+
### Patch Changes
6+
7+
- Fix start iterative fast calling makes lag
8+
39
## 1.2.0
410

511
### Minor Changes

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@freestylejs/ani-core",
33
"author": "freestyle",
4-
"version": "1.2.0",
4+
"version": "1.2.1",
55
"description": "Core functionality for the Ani animation library.",
66
"license": "MIT",
77
"type": "module",

packages/core/src/ani/raf/timeline.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ export class RafAniTimeline<G extends Groupable, Ctx = any>
153153

154154
const isRepeating = (this._currentConfig?.repeat ?? 0) >= 1
155155
const savedRepeatCount = isRepeating ? this._repeatCount : 0
156+
const isPlaying = this._status === 'PLAYING'
156157

157-
this.reset(false)
158+
this.reset(false, !isPlaying)
158159
this._repeatCount = savedRepeatCount
159160

160161
if (isRepeating && this._repeatCount >= config.repeat!) {
@@ -194,7 +195,10 @@ export class RafAniTimeline<G extends Groupable, Ctx = any>
194195
this._clock.subscribe(this)
195196
}
196197

197-
public reset(notify: boolean = true): void {
198+
public reset(
199+
notify: boolean = true,
200+
unsubscribeClock: boolean = true
201+
): void {
198202
this._status = 'IDLE'
199203
this._currentConfig = null
200204
this._masterTime = 0
@@ -203,7 +207,9 @@ export class RafAniTimeline<G extends Groupable, Ctx = any>
203207
this._initialState = []
204208
this._propertyKeyMap = null
205209
this._currentExecutionPlan = null
206-
this._clock.unsubscribe(this)
210+
if (unsubscribeClock) {
211+
this._clock.unsubscribe(this)
212+
}
207213
this._repeatCount = 0
208214
if (notify) this.notify()
209215
}

packages/react/package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,15 @@
33
"author": "freestyle",
44
"version": "1.1.0",
55
"description": "Ani for react.",
6-
"keywords": [
7-
"react",
8-
"animation"
9-
],
6+
"keywords": ["react", "animation"],
107
"license": "MIT",
118
"type": "module",
129
"sideEffects": false,
1310
"private": false,
1411
"publishConfig": {
1512
"access": "public"
1613
},
17-
"files": [
18-
"dist"
19-
],
14+
"files": ["dist"],
2015
"main": "./dist/index.js",
2116
"module": "./dist/index.mjs",
2217
"types": "./dist/index.d.ts",

packages/solid/package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@
55
"description": "Ani for solid.",
66
"license": "MIT",
77
"type": "module",
8-
"keywords": [
9-
"solid",
10-
"animation"
11-
],
8+
"keywords": ["solid", "animation"],
129
"sideEffects": false,
1310
"private": false,
1411
"publishConfig": {
1512
"access": "public"
1613
},
17-
"files": [
18-
"dist"
19-
],
14+
"files": ["dist"],
2015
"main": "./dist/index.js",
2116
"module": "./dist/index.mjs",
2217
"types": "./dist/index.d.ts",

packages/svelte/package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@
55
"description": "Ani for svelte.",
66
"license": "MIT",
77
"type": "module",
8-
"keywords": [
9-
"svelte",
10-
"animation"
11-
],
8+
"keywords": ["svelte", "animation"],
129
"sideEffects": false,
1310
"private": false,
1411
"publishConfig": {
1512
"access": "public"
1613
},
17-
"files": [
18-
"dist"
19-
],
14+
"files": ["dist"],
2015
"main": "./dist/index.js",
2116
"module": "./dist/index.mjs",
2217
"types": "./dist/index.d.ts",

packages/vue/package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@
55
"description": "Ani for vue.",
66
"license": "MIT",
77
"type": "module",
8-
"keywords": [
9-
"vue",
10-
"animation"
11-
],
8+
"keywords": ["vue", "animation"],
129
"sideEffects": false,
1310
"private": false,
1411
"publishConfig": {
1512
"access": "public"
1613
},
17-
"files": [
18-
"dist"
19-
],
14+
"files": ["dist"],
2015
"main": "./dist/index.js",
2116
"module": "./dist/index.mjs",
2217
"types": "./dist/index.d.ts",

packages/web/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
"fumadocs-typescript": "^4.0.13",
2121
"fumadocs-ui": "16.0.8",
2222
"lucide-react": "^0.552.0",
23-
"next": "16.0.1",
23+
"next": "16.0.7",
2424
"octokit": "^5.0.5",
25-
"react": "^19.2.0",
26-
"react-dom": "^19.2.0",
25+
"react": "^19.2.1",
26+
"react-dom": "^19.2.1",
2727
"tailwind-merge": "^3.4.0",
2828
"tailwindest": "^3.2.2",
2929
"twoslash": "^0.3.4"

0 commit comments

Comments
 (0)