In my case, I didn't just want absolute X and Y values, but wanted to see how those X and Y values had changed since the last callback.
By exposing the previous X and Y values in our callback via two new arguments, I can now calculate these deltas. For example:
new Impetus({
source: '#some-element',
update: function(x, y, px, py) {
console.log('x ', x);
console.log('y ', y);
console.log('previous x ', px);
console.log('previous y ', py);
console.log('change in x ', x - px);
console.log('change in y ', y - py);
}
});
I've also included the commits from #41 (Fix memory leaks) since those proved to be a fairly useful addition to the codebase.
In my case, I didn't just want absolute X and Y values, but wanted to see how those X and Y values had changed since the last callback.
By exposing the previous X and Y values in our callback via two new arguments, I can now calculate these deltas. For example:
I've also included the commits from #41 (Fix memory leaks) since those proved to be a fairly useful addition to the codebase.