now handles scroll position, and passes state data to transition functions