An attack telegraphs a direction. Move the opposite way before the bar runs out.
Desktop: arrow keys dodge, Space parries. Mobile: swipe to dodge, tap to parry.