Search the Community
Showing results for tags 'pre-render'.
So, this one had me going for about 5 hours yesterday. Maybe it was a late night, but in case anyone else runs into the same problem I thought I'd post about it. The story so far :: I've been programming a game for mobiles using kinetic & the lite greensock libraries. In order to keep the main animation loop nice and tight the plan was to generate all of the tweens during the initialisation phase, store them in an array and call them by adding them to a timelinelite instance depending on what phase the game was in. The problem :: every time I created a new tween it ran ! Not so handy when trying to pre-compute them. I looked at test code I had written when coming up with a strategy and that code was running fine. I could create the tweens, store them in variables, and they'd be ready. There seemed no difference in the code, but the results were different. The (eventual) solution :: It turned out to be a scoping thing. Because most of the functions for the game are in a different js file, and I was creating the main work-horse timelinelite instance in the main page when adding the tweens in the function stored in the js file, I'm guessing the library thought "hmm, I can't see a TLL object, I better run these right away" So it was a really easy fix in the end, I just declared a paused dummy TLL object in the function which sets up the tween presets, add the tweens to this a few lines of code after setting them up and all is well. They're ready for use when needed. It's probably just a case of me not RTFM correctly, but I couldnt' see any info about it. Hope this nugget helps someone avoid the head scratching and beard pulling I went through ! Bests om