Skip to content

Commit 2ec9ecb

Browse files
author
daniel-lundin
committed
Fix delay for spring animations
1 parent 3069ee7 commit 2ec9ecb

File tree

4 files changed

+971
-89
lines changed

4 files changed

+971
-89
lines changed

dist/jquery.snabbt.min.js

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/snabbt.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/animations.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ snabbtjs.Animation.prototype.assign = function(options) {
4242

4343
snabbtjs.Animation.prototype.tick = function(time) {
4444
// If first tick, set start_time
45+
if(!this.start_time) {
46+
this.start_time = time;
47+
}
4548
if(this.mode == snabbtjs.AnimationType.TIME) {
46-
if(!this.start_time) {
47-
this.start_time = time;
48-
}
4949
if(time - this.start_time > this.delay)
5050
this.current_time = time - this.delay;
5151
} else if(this.mode == snabbtjs.AnimationType.SPRING) {
52-
this.spring.tick();
52+
if(time - this.start_time > this.delay)
53+
this.spring.tick();
5354
}
5455
};
5556

0 commit comments

Comments
 (0)