how can I make an animation take part of a state that repeats itself ?
I'm not clear on what you are asking.
States only save properties and transition between those properties for you. If you want to trigger other pieces of code, what you can do is listen to a state changes of a layer, then execute the desired piece of code. Check this out: http://framerjs.com/docs/#events.state
Alternatively, you could listen to the animationEnd event of a layer to trigger the other's animation.
layerA.onAnimationEnd -> layerB.states.next()
layerB.onAnimationEnd -> layerA.states.next()