|
|
|
|
|
|
|
|
|
|
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
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|