PitchKit
API Reference@pitchkit/data-providersmetricaFunctions

attackingDirection()

function attackingDirection(frame, team): "left_to_right" | "right_to_left" | null;

Defined in: packages/data-providers/src/metrica/select.ts:95

Which way a side is attacking, read off a frame.

Neither file states it, and it differs between the sample games: Home attack towards x = 1 in Sample Game 1's first half and towards x = 0 in Sample Game 2's. Teams swap at half time.

This compares the side's mean x with the halfway line, so pass a kick-off frame, where the laws put every player in their own half and the answer is unambiguous; the first frame of each period is one. Mid-play, a side pressing high can stand mostly in the opponent's half. Returns null if the side has no one on the pitch in the frame.

Parameters

ParameterType
frameMetricaFrame
teamMetricaTeam

Returns

"left_to_right" | "right_to_left" | null

On this page