MCPcopy Create free account
hub / github.com/Vanilagy/webcodecs-polyfill / AddRotations

Function AddRotations

src/video_frame.ts:1084–1091  ·  view source on GitHub ↗
(baseRotation: number, baseFlip: boolean, rotation: number)

Source from the content-addressed store, hash-verified

1082};
1083
1084const AddRotations = (baseRotation: number, baseFlip: boolean, rotation: number): number => {
1085 // 1. If baseFlip is false, let combinedRotation be |baseRotation| + |rotation|.
1086 const combinedRotation = baseFlip ? baseRotation - rotation : baseRotation + rotation;
1087 // 2. Let fullTurns be the greatest multiple of 360 less than or equal to combinedRotation.
1088 const fullTurns = Math.floor(combinedRotation / 360) * 360;
1089 // 3. Return |combinedRotation| - |fullTurns|.
1090 return Math.abs(combinedRotation) - Math.abs(fullTurns);
1091};
1092
1093const ValidateVideoFrameInit = (
1094 init: VideoFrameInit,

Calls

no outgoing calls

Tested by

no test coverage detected