There’s a couple of ways:
The mask way is simple but if you have overlapping splines you have to additionally mask where the overpass leaks through (like a script “e or a”). or in your case where the head catches up with the tail.
You can also use the gradient Wipe effect. Make a stoke or path in either pshop or AE than has a gradient that travels over the length of the path. So an S would be dark at the top and gradiate to white at the bottom. Then turn this layer off and take the layer you want to animate and apply the Gradient Wipe to it. In the effects dialog select the hidden layer and use this as your “Source” and then animate the “Transition complete” paramater. You can make the stroked gradient larger/wider than the shape you want to animate on and then choose a layer to be the masking layer to keep the original shape.
There is a script on aescripts.com called Boa that is stellar at this and has tons of other features too.
You can use the mask idea again but use a paint stroke that you animate on (stroke it in real time and then adjust the recorded stroke to your liking). Use this element as your revealing mask.
Depending on the shape you can use particular to acheive this as well.