( byteArray: ByteArray, config: BaseAttribute, flag: AttributeFlag, )
| 163 | }; |
| 164 | |
| 165 | export const readKeyframes = <T>( |
| 166 | byteArray: ByteArray, |
| 167 | config: BaseAttribute, |
| 168 | flag: AttributeFlag, |
| 169 | ): Array<Keyframe<T>> => { |
| 170 | const keyframes: Array<any> = []; |
| 171 | const numFrames: number = byteArray.readEncodedUint32(); |
| 172 | for (let i = 0; i < numFrames; i++) { |
| 173 | let keyframe: Keyframe<T>; |
| 174 | if (config.attributeType === AttributeType.DiscreteProperty) { |
| 175 | keyframe = new Keyframe<T>(); |
| 176 | } else { |
| 177 | const interpolationType = byteArray.readUBits(2) as KeyframeInterpolationType; |
| 178 | if (interpolationType === KeyframeInterpolationType.Hold) { |
| 179 | keyframe = new Keyframe<T>(); |
| 180 | } else { |
| 181 | keyframe = config.newKeyframe(flag); |
| 182 | keyframe.interpolationType = interpolationType; |
| 183 | } |
| 184 | } |
| 185 | keyframes.push(keyframe); |
| 186 | } |
| 187 | |
| 188 | return keyframes; |
| 189 | }; |
| 190 | |
| 191 | const readTimeAndValue = <T>(byteArray: ByteArray, keyframes: Array<Keyframe<T>>, config: BaseAttribute) => { |
| 192 | const numFrames: number = keyframes.length; |
no test coverage detected