Question - preloading motions
I wonder if there is a way to pre-load mtns.
load_motion(motion1.mtn);
...
load_motion(motion2.mtn);
...
load_motion(motion1.mtn);
function load_motion(mtn){
Figure.loadBytes(mtn, function(buf){
motion = new Live2DMotion.loadMotion(buf);
});
}
Very frequently, I load
motion1
, then soon
motion2
, and soon after
motion1
again.
The above code is making my game run slow on some devices. There isn't a lot of mtns. I need to interchange mtns frequently.
So I want to ask : How do I preload mtns?
PS: I tried to make an array (which would store all the motion bytes), for loop and this:
motion[i] = new Live2DMotion.loadMotion(buf);
. But it doesn't work.
Thank you in advance
0 ·
Comments
Near the very beginning, just after the
.model.json
is defined into your code: And in the periodic draw function: