VectorKeyframeTrack.js 856 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. *
  3. * A Track that interpolates Vectors
  4. *
  5. * @author Ben Houston / http://clara.io/
  6. * @author David Sarno / http://lighthaus.us/
  7. */
  8. THREE.VectorKeyframeTrack = function ( name, keys ) {
  9. THREE.KeyframeTrack.call( this, name, keys );
  10. // local cache of value type to avoid allocations during runtime.
  11. this.result = this.keys[0].value.clone();
  12. };
  13. THREE.VectorKeyframeTrack.prototype = {
  14. constructor: THREE.VectorKeyframeTrack,
  15. setResult: function( value ) {
  16. this.result.copy( value );
  17. },
  18. // memoization of the lerp function for speed.
  19. // NOTE: Do not optimize as a prototype initialization closure, as value0 will be different on a per class basis.
  20. lerpValues: function( value0, value1, alpha ) {
  21. return value0.slerp( value1, alpha );
  22. },
  23. compareValues: function( value0, value1 ) {
  24. return value0.equals( value1 );
  25. }
  26. };
粤ICP备19079148号