Why are these sharks doing the ‘pipi’ dance?

A group of sharks writhing in shallow water may have looked like they were beached, but they weren’t injured or in distress.

Source: https://www.livescience.com/sharks-pipi-dance-australia.html