Skip to content

Commit

Permalink
0.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
David Schäfer committed Jun 4, 2018
1 parent 04275dc commit 38764c0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -2,7 +2,7 @@
"name": "attriboots",
"description": "",
"homepage": "https://github.com/okitu/attriboots",
"version": "0.0.12",
"version": "0.0.13",
"main": "dist/attriboots.js",
"author": {
"name": "David Schäfer",
Expand Down
37 changes: 28 additions & 9 deletions dist/attriboots.js
@@ -1,5 +1,5 @@
/**
* attriboots@0.0.12
* attriboots@0.0.13
* https://github.com/okitu/attriboots
*
* @license
Expand Down Expand Up @@ -31,7 +31,7 @@
(function(global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.attriboots = global.attriboots || {})));
(factory((global.attriboots = {})));
}(this, (function(exports) {
'use strict';

Expand Down Expand Up @@ -818,6 +818,7 @@

/**
* Adds `offset` to `target` and `current`.
* Will not reset animation times.
* @param {number} offset
*/

Expand All @@ -828,7 +829,11 @@

if (!this.locked && offset !== 0) {

// Prevent animation start & times from changing
this._isAddingOffset = true;

this.target += offset;
this._isAddingOffset = false;

// Target may have been clamped
var actualOffset = this._target - this._lastTarget;
Expand Down Expand Up @@ -905,11 +910,13 @@

this._lastTarget = this._target;

this._start = this.current;
this._startTime = this._currentTime = Date.now();
if (!this._isAddingOffset) {
this._start = this.current;
this._startTime = this._currentTime = Date.now();
this._targetTime = this._startTime + this._animationTime;
}

this._target = target;
this._targetTime = Date.now() + this._animationTime;

this._triggerChange('target', this._target);

Expand Down Expand Up @@ -1142,6 +1149,7 @@

/**
* Adds `offset` to `target` and `current`.
* Will not reset animation times.
* @param {number} offset
* @override
*/
Expand All @@ -1153,7 +1161,11 @@

if (!this.locked && offset !== 0) {

// Prevent animation start & times from changing
this._isAddingOffset = true;

this.target += offset;
this._isAddingOffset = false;

// Target may have been clamped
var actualOffset = this.target - this._lastTarget;
Expand Down Expand Up @@ -1185,10 +1197,13 @@
}, {
key: '_applyShortRotation',
value: function _applyShortRotation() {
this._start = this._wrapTo360Degrees(this._start);

// fix for short rotation
while (this._start - this._target > 180) {
this._start -= 360;
}

while (this._start - this._target < -180) {
this._start += 360;
}
Expand Down Expand Up @@ -1241,17 +1256,21 @@

if (!this._ignoreBounds) target = this._clamp(target);

if (this._wrap) target = this._wrapTo360Degrees(target);

if (target == this._target) return;

this._lastTarget = this.target;

this._start = this.current;
this._startTime = this._currentTime = Date.now();
if (!this._isAddingOffset) {
this._start = this.current;
this._startTime = this._currentTime = Date.now();
this._targetTime = this._startTime + this._animationTime;
}

this._target = target;
this._targetTime = Date.now() + this._animationTime;

if (this._wrap && this._shortRotation) this._applyShortRotation();
if (this._wrap && this._shortRotation && !this._isAddingOffset) this._applyShortRotation();

this._triggerChange('target', this._target);

Expand Down

0 comments on commit 38764c0

Please sign in to comment.