Skip to content

Commit

Permalink
v1.2.3 fix reset on repeat loop
Browse files Browse the repository at this point in the history
  • Loading branch information
reececomo committed May 1, 2024
1 parent 91d1e56 commit e9405a0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pixijs-actions",
"version": "1.2.2",
"version": "1.2.3",
"author": "Reece Como <[email protected]>",
"authors": [
"Reece Como <[email protected]>",
Expand Down
17 changes: 17 additions & 0 deletions src/__tests__/Action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,23 @@ describe('Action Chaining', () => {
node.removeAllActions();
});

it('loops correctly with scaleTo (regression case)', () => {
const node = new Container();
node.run(Action.repeatForever(Action.sequence([
Action.scaleTo(0.9, 1.0).easeInOut(),
Action.scaleTo(10, 1.0).easeInOut(),
])));

simulateTime(1.0);
expect(node.scale.x).toBeCloseTo(0.9);

simulateTime(1.0);
expect(node.scale.x).toBeCloseTo(10);

simulateTime(0.1, 1);
expect(node.scale.x).toBeGreaterThan(9.5);
});

it('should loop over a group', () => {
const group = Action.group([
Action.moveByX(5, 1.0),
Expand Down
1 change: 1 addition & 0 deletions src/lib/ActionTicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export class ActionTicker {
public reset(): void {
this._elapsed = 0.0;
this.isDone = false;
this._isSetup = false;
(this.action as any).onTickerDidReset(this);
}
}
Expand Down

0 comments on commit e9405a0

Please sign in to comment.