Skip to content

Commit

Permalink
Merge pull request #21 from nicholaswhite656/numerical-easing
Browse files Browse the repository at this point in the history
feature: easing can be configured by number
  • Loading branch information
igorlino committed Nov 14, 2015
2 parents 4b4d467 + 32bdd14 commit beb3dd8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion demo/examples.htm
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ <h3><a name="easing">Easing</a></h3>

<p>
You can use the default easing or a custom easing setting.
The amount of easing can also be altered - default is 12, set higher for more, lower for
The amount of easing can also be altered - default is 16, set higher for more, lower for
less

</p>
Expand All @@ -670,6 +670,7 @@ <h3><a name="easing">Easing</a></h3>
$(document).ready(function () {
$("#zoom_10").ezPlus({
easing: true
// true is the same as 16; try 5 or 20
});

});
Expand Down
6 changes: 5 additions & 1 deletion src/jquery.ez-plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,10 @@ if (typeof Object.create !== 'function') {
if (!self.yp) {
self.yp = 0;
}
var interval = 16;
if (Number.isInteger(parseInt(self.options.easing))){
interval = parseInt(self.options.easing);
}
//if loop not already started, then run it
if (!self.loop) {
self.loop = setInterval(function () {
Expand Down Expand Up @@ -1190,7 +1194,7 @@ if (typeof Object.create !== 'function') {

self.zoomWindow.css('background-position', self.xp + 'px ' + self.yp + 'px');
}
}, 16);
}, interval);
}
}
else {
Expand Down

0 comments on commit beb3dd8

Please sign in to comment.