The component along axis: x if horizontal, y if vertical.
axis
double axis(Axis axis) => axis == .horizontal ? x : y;