State Driven Animation Framework for Page transitions using Javascript