Skip to content

Commit

Permalink
KeyframeTrack: Converted Object.assign() with *.prototype.*
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Feb 17, 2021
1 parent 582df68 commit 6100437
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 76 deletions.
12 changes: 3 additions & 9 deletions src/animation/KeyframeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,8 @@ class KeyframeTrack {

}

Object.assign( KeyframeTrack.prototype, {

TimeBufferType: Float32Array,

ValueBufferType: Float32Array,

DefaultInterpolation: InterpolateLinear,

} );
KeyframeTrack.prototype.TimeBufferType = Float32Array;
KeyframeTrack.prototype.ValueBufferType = Float32Array;
KeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;

export { KeyframeTrack };
24 changes: 9 additions & 15 deletions src/animation/tracks/BooleanKeyframeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@ import { KeyframeTrack } from '../KeyframeTrack.js';
*/
class BooleanKeyframeTrack extends KeyframeTrack {}

Object.assign( BooleanKeyframeTrack.prototype, {

ValueTypeName: 'bool',
ValueBufferType: Array,

DefaultInterpolation: InterpolateDiscrete,

InterpolantFactoryMethodLinear: undefined,
InterpolantFactoryMethodSmooth: undefined

// Note: Actually this track could have a optimized / compressed
// representation of a single value and a custom interpolant that
// computes "firstValue ^ isOdd( index )".

} );
BooleanKeyframeTrack.prototype.ValueTypeName = 'bool';
BooleanKeyframeTrack.prototype.ValueBufferType = Array;
BooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;
BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;
BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;

// Note: Actually this track could have a optimized / compressed
// representation of a single value and a custom interpolant that
// computes "firstValue ^ isOdd( index )".

export { BooleanKeyframeTrack };
16 changes: 5 additions & 11 deletions src/animation/tracks/ColorKeyframeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@ import { KeyframeTrack } from '../KeyframeTrack.js';
*/
class ColorKeyframeTrack extends KeyframeTrack {}

Object.assign( ColorKeyframeTrack.prototype, {
ColorKeyframeTrack.prototype.ValueTypeName = 'color';
// ValueBufferType is inherited
// DefaultInterpolation is inherited

ValueTypeName: 'color'

// ValueBufferType is inherited

// DefaultInterpolation is inherited

// Note: Very basic implementation and nothing special yet.
// However, this is the place for color space parameterization.

} );
// Note: Very basic implementation and nothing special yet.
// However, this is the place for color space parameterization.

export { ColorKeyframeTrack };
12 changes: 3 additions & 9 deletions src/animation/tracks/NumberKeyframeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ import { KeyframeTrack } from '../KeyframeTrack.js';
*/
class NumberKeyframeTrack extends KeyframeTrack {}

Object.assign( NumberKeyframeTrack.prototype, {

ValueTypeName: 'number'

// ValueBufferType is inherited

// DefaultInterpolation is inherited

} );
NumberKeyframeTrack.prototype.ValueTypeName = 'number';
// ValueBufferType is inherited
// DefaultInterpolation is inherited

export { NumberKeyframeTrack };
15 changes: 4 additions & 11 deletions src/animation/tracks/QuaternionKeyframeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@ class QuaternionKeyframeTrack extends KeyframeTrack {

}

Object.assign( QuaternionKeyframeTrack.prototype, {

ValueTypeName: 'quaternion',

// ValueBufferType is inherited

DefaultInterpolation: InterpolateLinear,

InterpolantFactoryMethodSmooth: undefined // not yet implemented

} );
QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';
// ValueBufferType is inherited
QuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;
QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;

export { QuaternionKeyframeTrack };
17 changes: 5 additions & 12 deletions src/animation/tracks/StringKeyframeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@ import { KeyframeTrack } from '../KeyframeTrack.js';
*/
class StringKeyframeTrack extends KeyframeTrack {}

Object.assign( StringKeyframeTrack.prototype, {

ValueTypeName: 'string',
ValueBufferType: Array,

DefaultInterpolation: InterpolateDiscrete,

InterpolantFactoryMethodLinear: undefined,

InterpolantFactoryMethodSmooth: undefined

} );
StringKeyframeTrack.prototype.ValueTypeName = 'string';
StringKeyframeTrack.prototype.ValueBufferType = Array;
StringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;
StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;
StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;

export { StringKeyframeTrack };
12 changes: 3 additions & 9 deletions src/animation/tracks/VectorKeyframeTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ import { KeyframeTrack } from '../KeyframeTrack.js';
*/
class VectorKeyframeTrack extends KeyframeTrack {}

Object.assign( VectorKeyframeTrack.prototype, {

ValueTypeName: 'vector'

// ValueBufferType is inherited

// DefaultInterpolation is inherited

} );
VectorKeyframeTrack.prototype.ValueTypeName = 'vector';
// ValueBufferType is inherited
// DefaultInterpolation is inherited

export { VectorKeyframeTrack };

0 comments on commit 6100437

Please sign in to comment.