Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
730 B

public IEnumerator FlipToPage(int targetPage, float animationTime){
int startPage = currentPage;
float elapsedTime = 0;
while (elapsedTime < animationTime){
currentPage = (int)Mathf.lerp(startPage,targetPage,elaspedTime/animationTime);
yield return new waitForFrame();
elapsedTime += Time.deltaTime;
}
currentPage = targetPage;
}
public IEnumerator PingPong(int startPage, int endPage, float animationTime,float PauseTime){
int currentPage = currentPage;
int targetPage = endPage;
While(true){
yield return startCoroutine(FlipToPage(targetPage,animationTime)
yield return new WaitForSeconds(PauseTime)
targetPage = (targetPage == endPage) ? startPage : endPage
}
}