@@ -84,7 +84,6 @@ export class GraphicEntityModule {
8484 this . extrapolationMap [ entity . id ] = { ...entity . defaultState }
8585 }
8686
87- const currentState = this . extrapolationMap [ entity . id ]
8887 const subStates = entity . states [ frameNumber ]
8988
9089 // Sort on t to begin extrapolation
@@ -94,20 +93,23 @@ export class GraphicEntityModule {
9493 // Create a subState at t=1
9594 entity . addState ( 1 , { } , frameNumber , frameInfo )
9695 }
97- let prevState = currentState
96+
97+ let prevState = this . extrapolationMap [ entity . id ] // currentState
9898 // If the entity had a state in the previous frame get the last one of them
9999 if ( entity . states [ previousFrameNumber ] && previousFrameNumber !== frameNumber ) {
100100 prevState = entity . states [ previousFrameNumber ] [ entity . states [ previousFrameNumber ] . length - 1 ]
101101 }
102- for ( const state of subStates ) {
102+
103+ entity . states [ frameNumber ] = subStates . map ( ( subState ) => {
103104 // Extrapolate through existing substates, updating the extrapolationMap in the process (currentState)
104- Object . assign ( currentState , state )
105- Object . assign ( state , currentState )
105+ const state = this . extrapolationMap [ entity . id ] = { ... this . extrapolationMap [ entity . id ] , ... subState }
106+
106107 if ( typeof entity . computeAnimationProgressTime === 'function' ) {
107108 entity . computeAnimationProgressTime ( prevState , state )
108109 }
109110 prevState = state
110- }
111+ return state
112+ } )
111113 } )
112114 }
113115
0 commit comments