diff --git a/src/animation/KeyframeTrack.js b/src/animation/KeyframeTrack.js index d4900673889def..304e0427bbe5c8 100644 --- a/src/animation/KeyframeTrack.js +++ b/src/animation/KeyframeTrack.js @@ -347,8 +347,9 @@ Object.assign( KeyframeTrack.prototype, { // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) optimize: function () { - var times = this.times, - values = this.values, + // times or values may be shared with other tracks, so overwriting is unsafe + var times = AnimationUtils.arraySlice( this.times ), + values = AnimationUtils.arraySlice( this.values ), stride = this.getValueSize(), smoothInterpolation = this.getInterpolation() === InterpolateSmooth, @@ -443,6 +444,11 @@ Object.assign( KeyframeTrack.prototype, { this.times = AnimationUtils.arraySlice( times, 0, writeIndex ); this.values = AnimationUtils.arraySlice( values, 0, writeIndex * stride ); + } else { + + this.times = times; + this.values = values; + } return this;