Refactor animations to do compileGraph function