2D animation
I made it so the animation starts when i click it and ends after one loop but it starts and ends mid animation.
This is the animation script i used in case you where wondering\
// -----JS CODE-----
var gifAnimation = script.getSceneObject().getFirstComponent("Component.SpriteVisual");
var loops = 1;
var offset = 0.0;
gifAnimation.getMaterial(0).getPass(0).baseTex.control.play(loops, offset);
-
Hey Some Guy,
Just to make sure - are you asking why your animation is ending in the middle and sharing your code for help? Or are you simply sharing your code?
Cheers,
KaitlynComment actions -
I am asking why it is stopping in the middle
Comment actions -
Your script looks correct. As long as offset is 0 is should play at the beginning. I suspect something went wrong with the ordering of your sprites you imported in when the Sprite Sheet was created. Can you go your project folder on you computer and find the Public folder. In the Public folder, you should see another folder labeled "animation" or whatever you named your animated texture. Then, find the first atlas texture likely named atlas_0.png. Can you check that the first frame of this atlas texture (top left corner) is in fact the first frame of your animation?
If it's not, you might need to recreate the animation. When importing your sequence, the name of the file for each frame determines the order. Can you make sure they are named in the order you want them imported? E.g. suffixing each from with _1.png, _2.png, _3.png etc.
Comment actions
Please sign in to leave a comment.
Have a comment?