Skip to content

Commit 62f5438

Browse files
Fix defaulting to 1
1 parent 2c738b2 commit 62f5438

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
var raf = typeof window !== 'undefined' && 'requestAnimationFrame' in window
2+
? window.requestAnimationFrame
3+
: function(func) {
4+
setTimeout(func, 16)
5+
};
6+
17
function ease(options) {
2-
var startValue = options.startValue || 0;
3-
var endValue = options.endValue || 1;
4-
var durationMs = options.durationMs || 200;
8+
var startValue = 'startValue' in options ? options.startValue : 0;
9+
var endValue = 'endValue' in options ? options.endValue : 1;
10+
var durationMs = 'durationMs' in options ? options.durationMs : 200;
511
var onComplete = options.onComplete || function() {};
612

7-
var raf = window.requestAnimationFrame || function(func) {
8-
window.setTimeout(func, 16)
9-
};
1013
var stepCount = durationMs / 16;
1114
var valueIncrement = (endValue - startValue) / stepCount;
1215
var sinValueIncrement = Math.PI / stepCount;

0 commit comments

Comments
 (0)