提交 936664c2 编写于 作者: T tschw

Animation: Fixed & factored scan for clip duration.

上级 1e8081dc
......@@ -15,12 +15,7 @@ THREE.AnimationClip = function ( name, duration, tracks ) {
// this means it should figure out its duration by scanning the tracks
if ( this.duration < 0 ) {
for ( var i = 0; i < this.tracks.length; i ++ ) {
var track = this.tracks[i];
this.duration = Math.max( track.times[ track.times.length - 1 ] );
}
this.resetDuration();
}
......@@ -35,6 +30,24 @@ THREE.AnimationClip.prototype = {
constructor: THREE.AnimationClip,
resetDuration: function() {
var tracks = this.tracks,
duration = 0;
for ( var i = 0, n = tracks.length; i !== n; ++ i ) {
var track = this.tracks[ i ];
duration = Math.max(
duration, track.times[ track.times.length - 1 ] );
}
this.duration = duration;
},
trim: function() {
for ( var i = 0; i < this.tracks.length; i ++ ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册