-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Animation Tracks: Convert to es6 classes #20013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0dd3595
29bf1ba
2ab442f
c08f745
64d328b
fafd56a
161be07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,29 +5,24 @@ import { QuaternionLinearInterpolant } from '../../math/interpolants/QuaternionL | |
| /** | ||
| * A Track of quaternion keyframe values. | ||
| */ | ||
| class QuaternionKeyframeTrack extends KeyframeTrack { | ||
|
|
||
| function QuaternionKeyframeTrack( name, times, values, interpolation ) { | ||
| InterpolantFactoryMethodLinear( result ) { | ||
|
|
||
| KeyframeTrack.call( this, name, times, values, interpolation ); | ||
| return new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result ); | ||
|
|
||
| } | ||
| } | ||
|
|
||
| QuaternionKeyframeTrack.prototype = Object.assign( Object.create( KeyframeTrack.prototype ), { | ||
| } | ||
|
|
||
| constructor: QuaternionKeyframeTrack, | ||
| Object.assign( QuaternionKeyframeTrack.prototype, { | ||
|
|
||
| ValueTypeName: 'quaternion', | ||
|
|
||
| // ValueBufferType is inherited | ||
|
|
||
| DefaultInterpolation: InterpolateLinear, | ||
|
|
||
| InterpolantFactoryMethodLinear: function ( result ) { | ||
|
|
||
| return new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result ); | ||
|
|
||
| }, | ||
|
|
||
| InterpolantFactoryMethodSmooth: undefined // not yet implemented | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed this pattern where prototype methods are undefined to drive fallback logic in base |
||
|
|
||
| } ); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I debated whether or not to preserve these prototype properties. They should reduce memory footprint with a large number of animation tracks, though I don't know if that matters in real world usage. They seem better suited as static props than instance props? Anyways, let me know what direction is good and I can tweak this PR as needed.
Honestly, all of the inheritance doesn't seem that useful. In the long run maybe the track system could just be refactored with a more data-driven approach.