Edit: Still not fixed in 1.8.1 @jare@slackmoehrle do you plan to fix it or this is not an important thing, because I already fixed it on our side and it took half a day… I can send you the fix
function process () {
// sample
var info = this.sample();
var cache = this._hasListenerCache;
if (cache && cache['lastframe']) {
var lastInfo;
if (!this._lastWrappedInfo) {
lastInfo = this._lastWrappedInfo = new WrappedInfo(info);
} else {
lastInfo = this._lastWrappedInfo;
}
if (this.repeatCount > 1 && ((info.iterations | 0) > (lastInfo.iterations | 0))) {
if ((this.wrapMode & WrapModeMask.Reverse) === WrapModeMask.Reverse) {
if (lastInfo.direction < 0) {
this.emit('lastframe', this);
}
}
else {
if (lastInfo.direction > 0) {
this.emit('lastframe', this);
}
}
}
lastInfo.set(info);
}
if (info.stopped) {
this.stop();
this.emit('finished', this);
}
};
And the simpleProcess() become this:
function simpleProcess () {
var time = this.time;
var duration = this.duration;
if (time > duration) {
time = time % duration;
if (time === 0) time = duration;
}
else if (time < 0) {
time = time % duration;
if (time !== 0 ) time += duration;
}
var ratio = time / duration;
var curves = this.curves;
for (var i = 0, len = curves.length; i < len; i++) {
var curve = curves[i];
curve.sample(time, ratio, this);
}
var cache = this._hasListenerCache;
if (cache && cache['lastframe']) {
var lastIterations = this._lastIterations;
if (lastIterations === undefined) {
lastIterations = this._lastIterations = this.time;
}
if ((this.time | 0) > (lastIterations | 0)) {
this.emit('lastframe', this);
}
this._lastIterations = this.time;
}
}
Sorry, I tweeked the function to make them even better. The other version had weird corner case behavior:
function process () {
// sample
var info = this.sample();
var cache = this._hasListenerCache;
if (cache && cache['lastframe']) {
var lastInfo;
if (!this._lastWrappedInfo) {
lastInfo = this._lastWrappedInfo = new WrappedInfo(info);
} else {
lastInfo = this._lastWrappedInfo;
}
if (this.repeatCount > 1 && ((info.iterations | 0) > (lastInfo.iterations | 0))) {
this.emit('lastframe', this);
}
lastInfo.set(info);
}
if (info.stopped) {
this.stop();
this.emit('finished', this);
}
}
function simpleProcess () {
var time = this.time;
var duration = this.duration;
if (time > duration) {
time = time % duration;
if (time === 0) time = duration;
}
else if (time < 0) {
time = time % duration;
if (time !== 0 ) time += duration;
}
var ratio = time / duration;
var curves = this.curves;
for (var i = 0, len = curves.length; i < len; i++) {
var curve = curves[i];
curve.sample(time, ratio, this);
}
var cache = this._hasListenerCache;
if (cache && cache['lastframe']) {
if (this._lastIterations === undefined) {
this._lastIterations = ratio;
}
if ((this.time > 0 && this._lastIterations > ratio) || (this.time < 0 && this._lastIterations < ratio)) {
this.emit('lastframe', this);
}
this._lastIterations = ratio;
}
}