HTML and CSS Reference
In-Depth Information
Looping Through the Tiles
Wewillupdatethe frameIndex valueoneachframetick.When frameIndex becomesgreater
than 7 , we will set it back to 0 :
frameIndex ++ ;
iif ( frameIndex == animationFrames . length ) {
frameIndex = 0 ;
}
The animationFrames.length valueis 8 .Whenthe frameIndex isequalto 8 ,wemustsetit
backto 0 tostartreadingthearrayvaluesoveragain,whichcreatesaninfiniteanimationloop.
Search WWH ::




Custom Search