开发者

AnimationDrawable frame duration problems

i need to create an animation frame by frame but i have some problems I have 30 png images that compose my animation, i load my A开发者_开发知识库nimationDrawable with this code:

        mCurrentAnimation = new AnimationDrawable();
        mCurrentAnimation.setOneShot(true);
        int resId;
        for (int j = 1; j < 31; j++)
        {                  
            resId = getResources().getIdentifier("resName", "drawable", "com.mindcolorstest.main");
            mCurrentAnimation.addFrame(getResources().getDrawable(resId), 1);
        }

And logically "mCurrentAnimation.start()" to start On mdpi device the animation works fine but i have some troubles with duration of every frame, on hdpi emulator or device i have some lag and if i will reduce duration of frames (both on mdpi or hdpi device) the animation will not go faster, like exist a minimum duration for every frame. Some tips and tricks? I don't know what i have to do Q_Q Thanks anyway


i agree on this, i do more or less the same with a xml animation-list even on the S4 i get a much longer animation time per frame then i have set. (i have set the duration to 3ms per frame).
i messured about 16,16ms per frame as minimum average over 30 cycles and 85frames.

this may or may not respond to the line scheduleSelf(mAnimationRunnable, now + 1000/60); in animate() in DrawableContainer. just a guess because 1000/60 = 16,66 what should become 16 as int/long cast..

but it could also come from some other limitation in code or hardware speed.
i have not checked if the code in this line gets called and is causing this because i can't somehow break there.
however i think no display is that fast in reality so it looks clever..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜