PNG Sequence animation issue
Hello,
I have a recurring issue with animations from PNG sequences. I play the animations using the Fullscreen State template, as the second state. When I preview the animation in the inspector window everything seems fine. When I play the animation for the first time in the preview window, everything seems fine too. But when I then go through the states again, disabling and re-enabling the objects and animations, the last frame always seems to come in front of the entire animation.
I have been experiencing this issue on every lens with an animation from a PNG sequence. There's is no mistake in the order of PNG files, and I don't change any settings in the PNG importer window. I export the PNG sequences either from Adobe Premiere or After Effects.
Here's a link to the most recent lens: https://www.snapchat.com/unlock/?type=SNAPCODE&uuid=e49e1923c9ba4965ac886a022bf152c0&metadata=01
And here's an example of what happens. Both the blue layer and the logo animation start completely transparent in my project, but not in the actual lens: https://drive.google.com/file/d/12hGc2lnjXLUjTQWqSS1cAqgh7XU6ZFcU/view?usp=sharing
Hi Bram,
have you tried starting an empty project, adding a billboard object, and setting your animation as its texture?
This has always worked for me. I do however export my PNGs from Photoshop, but this should make no difference as long as your files appear transparent when exported.
Cheers,
Luka
Hi Luka,
Thank for your reply. Starting from scratch and adding a billboard object with the animation as texture does work. But the goal is to make the animation work with the FullscreenStateManager. As soon as I drop in those scripts and tie the billboard object to a state, the last frame appears at the beginning of the animation. Strange thing is: if I reset the lens, I can go through the states with the correct animation showing up. Only after going back to state 1 and doing the cycle again is when it glitches.
So, for the first cycle of states after resetting the preview:
State 1: is nothing, just waits for a tap.
State 2: enables the billboard object and the animation and disables the object and stops the animation at the last frame. Waits for tap to reset back to State 1.
Second cycle:
State 1: nothing again, animation and object have successfully been disabled.
State 2: end frame shows first, and then the animation plays and stops at the last frame.
Thanks for your time!
Bram
Hi Bram!
Thanks for the in depth report! It's super helpful.
Currently the fullscreen state plays the sprite on late update, to change this so that it plays exactly when the object is enabled, please try adding the following to "onStateStart" function on line 104 of FullscreenTemplateState:
(If you're wondering, yes, this script comes from the "onStateLateStart" function :) )
Let me know if this helps.
Cheers,
Jon
Hi Jon,
Thanks so much for the help, your solution was perfect!
Cheers,
Bram