Minecraft wiki entry for Target_selectors, associated text: Examples in Java Edition:
@e[x_rotation=0] — Select all entities that are looking directly at the horizon.
@e[x_rotation=30..60] — Select all entities that are looking between 30° and 60° (inclusive) below the horizon.
@e[x_rotation=..0] — Select all entities that are looking at or above the horizon.