We changed stop in tween.js to this, to stop all tweens in a chain:
stop: function () {
if ( !this._chained ) {
this.playing = false;
this.stopped = true;
}
else {
// Chained. Iterate, tracking what we've seen (to avoid infinite loops).
// Could use a chase-pointer, but the list is likely to
// be short, and we'll avoid extra stops this way,
// but likely take extra GC load due to the array.
var seen = [];
for ( var cur = this; cur && seen.indexOf(cur) === -1; cur = cur._chained ) {
cur.playing = false;
cur.stopped = true;
seen.push( cur );
}
}
},
Posting this more or less as a "Request for Comment".
We ran into a few cases where devs assumed stopping the head of a chain would stop the rest, and bugs resulted. I could see arguing for a separate stopChain or similar, and the singly-linked nature of the chain makes the prospect of stopping something mid-chain a little wonky, so -- not sure what I think about this generally. But we're likely to ship with it for at least one game, so it seemed worth bumping upstream for comment.
We changed
stop
in tween.js to this, to stop all tweens in a chain:Posting this more or less as a "Request for Comment".
We ran into a few cases where devs assumed stopping the head of a chain would stop the rest, and bugs resulted. I could see arguing for a separate
stopChain
or similar, and the singly-linked nature of the chain makes the prospect of stopping something mid-chain a little wonky, so -- not sure what I think about this generally. But we're likely to ship with it for at least one game, so it seemed worth bumping upstream for comment.