KeyframeTrackConstructor.js 640 B

12345678910111213141516171819202122232425
  1. import { AnimationUtils } from './AnimationUtils.js';
  2. function KeyframeTrackConstructor( name, times, values, interpolation ) {
  3. if ( name === undefined ) throw new Error( 'track name is undefined' );
  4. if ( times === undefined || times.length === 0 ) {
  5. throw new Error( 'no keyframes in track named ' + name );
  6. }
  7. this.name = name;
  8. this.times = AnimationUtils.convertArray( times, this.TimeBufferType );
  9. this.values = AnimationUtils.convertArray( values, this.ValueBufferType );
  10. this.setInterpolation( interpolation || this.DefaultInterpolation );
  11. this.validate();
  12. this.optimize();
  13. }
  14. export { KeyframeTrackConstructor };