public static < T > void setEndFrames ( List < ? extends Keyframe < T > > keyframes ) { int size = keyframes . size ( ) ; for ( int i = 0 ; i < size - 1 ; i ++ ) { // In the json, the keyframes only contain their starting frame. Keyframe < T > keyframe = keyframes . get ( i ) ; Keyframe < T > nextKeyframe = keyframes . get ( i + 1 ) ; keyframe . endFrame = nextKeyframe . startFrame ; if ( keyframe . endValue == null && nextKeyframe . startValue != null ) { keyframe . endValue = nextKeyframe . startValue ; if ( keyframe instanceof PathKeyframe ) { ( ( PathKeyframe ) keyframe ) . createPath ( ) ; } } } Keyframe < ? > lastKeyframe = keyframes . get ( size - 1 ) ; if ( ( lastKeyframe . startValue == null || lastKeyframe . endValue == null ) && keyframes . size ( ) > 1 ) { // The only purpose the last keyframe has is to provide the end frame of the previous // keyframe. //noinspection SuspiciousMethodCalls keyframes . remove ( lastKeyframe ) ; } }
The json doesn t include end frames . The data can be taken from the start frame of the next keyframe though .