11import { Quaternion } from '../math/Quaternion.js' ;
22import { AdditiveAnimationBlendMode } from '../constants.js' ;
33
4- // same as Array.prototype.slice, but also works on typed arrays
5- function arraySlice ( array , from , to ) {
6-
7- if ( isTypedArray ( array ) ) {
8-
9- // in ios9 array.subarray(from, undefined) will return empty array
10- // but array.subarray(from) or array.subarray(from, len) is correct
11- return new array . constructor ( array . subarray ( from , to !== undefined ? to : array . length ) ) ;
12-
13- }
14-
15- return array . slice ( from , to ) ;
16-
17- }
18-
194// converts an array to a specific type
205function convertArray ( array , type , forceClone ) {
216
@@ -279,14 +264,14 @@ function makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targe
279264 // Reference frame is earlier than the first keyframe, so just use the first keyframe
280265 const startIndex = referenceOffset ;
281266 const endIndex = referenceValueSize - referenceOffset ;
282- referenceValue = arraySlice ( referenceTrack . values , startIndex , endIndex ) ;
267+ referenceValue = referenceTrack . values . slice ( startIndex , endIndex ) ;
283268
284269 } else if ( referenceTime >= referenceTrack . times [ lastIndex ] ) {
285270
286271 // Reference frame is after the last keyframe, so just use the last keyframe
287272 const startIndex = lastIndex * referenceValueSize + referenceOffset ;
288273 const endIndex = startIndex + referenceValueSize - referenceOffset ;
289- referenceValue = arraySlice ( referenceTrack . values , startIndex , endIndex ) ;
274+ referenceValue = referenceTrack . values . slice ( startIndex , endIndex ) ;
290275
291276 } else {
292277
@@ -295,7 +280,7 @@ function makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targe
295280 const startIndex = referenceOffset ;
296281 const endIndex = referenceValueSize - referenceOffset ;
297282 interpolant . evaluate ( referenceTime ) ;
298- referenceValue = arraySlice ( interpolant . resultBuffer , startIndex , endIndex ) ;
283+ referenceValue = interpolant . resultBuffer . slice ( startIndex , endIndex ) ;
299284
300285 }
301286
@@ -350,7 +335,6 @@ function makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targe
350335}
351336
352337const AnimationUtils = {
353- arraySlice : arraySlice ,
354338 convertArray : convertArray ,
355339 isTypedArray : isTypedArray ,
356340 getKeyframeOrder : getKeyframeOrder ,
@@ -361,7 +345,6 @@ const AnimationUtils = {
361345} ;
362346
363347export {
364- arraySlice ,
365348 convertArray ,
366349 isTypedArray ,
367350 getKeyframeOrder ,
0 commit comments