@@ -49,9 +49,9 @@
</p>
<h3>[method:AnimationClip subclip]( [param:AnimationClip clip], [param:String name], [param:Number startFrame], [param:Number endFrame], [param:Number fps] )</h3>
- <div>
+ <p>
Creates a new clip, containing only the segment of the original clip between the given frames.
- </div>
+ </p>
<h2>Source</h2>
@@ -409,42 +409,14 @@ Object.assign( AnimationClip.prototype, {
},
- trim: function ( startTime, endTime ) {
+ trim: function () {
- if ( startTime === undefined ) startTime = 0;
- if ( endTime === undefined ) endTime = this.duration;
-
- var tracks = [];
- for ( var i = 0; i < this.tracks.length; ++ i ) {
- var track = this.tracks[ i ];
- var hasKeyframe = false;
- // omit tracks without frames between new start/end times
- for ( var j = 0; j < track.times.length; ++ j ) {
- if ( startTime <= track.times[ j ] && endTime > track.times [ j ] ) {
- hasKeyframe = true;
- break;
- }
- if ( ! hasKeyframe ) continue;
- this.tracks[ i ].trim( startTime, endTime );
+ for ( var i = 0; i < this.tracks.length; i ++ ) {
- tracks.push( this.tracks[ i ] );
+ this.tracks[ i ].trim( 0, this.duration );
}
- this.tracks = tracks;
return this;
@@ -347,9 +347,6 @@ 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 () {
- // TODO: Opt-out of optimization?
- return this;
var times = this.times,
values = this.values,
stride = this.getValueSize(),