Skip to content

Commit 73d6e25

Browse files
committed
AnimationClip: Prevent type loss when subclassing
1 parent c4872f5 commit 73d6e25

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/animation/AnimationClip.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class AnimationClip {
118118

119119
}
120120

121-
return new AnimationClip( json.name, json.duration, tracks, json.blendMode );
121+
return new this( json.name, json.duration, tracks, json.blendMode );
122122

123123
}
124124

@@ -185,7 +185,7 @@ class AnimationClip {
185185

186186
}
187187

188-
return new AnimationClip( name, - 1, tracks );
188+
return new this( name, - 1, tracks );
189189

190190
}
191191

@@ -251,7 +251,7 @@ class AnimationClip {
251251

252252
for ( const name in animationToMorphTargets ) {
253253

254-
clips.push( AnimationClip.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );
254+
clips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );
255255

256256
}
257257

@@ -381,7 +381,7 @@ class AnimationClip {
381381

382382
}
383383

384-
const clip = new AnimationClip( clipName, duration, tracks, blendMode );
384+
const clip = new this( clipName, duration, tracks, blendMode );
385385

386386
return clip;
387387

@@ -454,7 +454,7 @@ class AnimationClip {
454454

455455
}
456456

457-
return new AnimationClip( this.name, this.duration, tracks, this.blendMode );
457+
return new this.constructor( this.name, this.duration, tracks, this.blendMode );
458458

459459
}
460460

0 commit comments

Comments
 (0)