rearranged code for transitions in Protein.js